只有在部署到Heroku时才会发生Hibernate错误

时间:2018-12-16 20:16:07

标签: java hibernate heroku

我有一个使用Hibernate,ClearDB MySQL和Heroku的简单Java项目。当我通过Eclipse在本地运行(Tomcat 9.0)时,一切正常(包括检索持久对象),但是一旦部署到Heroku,我的OneToMany联接之一便收到了Hibernate“ mappedBy引用未知目标实体属性”。 / p>

这是错误,它带有堆栈跟踪,在部署时得到(由Main.java HttpServlet捕获并打印):

header("Content-type:image/png");

以下是涉及的Gmu(父级)和Tag(子级)对象:

Gmu.java

<?php
    header("Content-type:image/png");
    $picture = imagecreatefrompng("test.png");
    imagepng($picture);
?>

Tag.java

[PersistenceUnit: coloradotaghunter_manager] Unable to build Hibernate 
SessionFactory
Caused by...
mappedBy reference an unknown target entity property: com.coloradotaghunter.Tag.gmu in com.coloradotaghunter.Gmu.tags
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1249)
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120)
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:860)
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
com.coloradotaghunter.TagHunterService.<init>(TagHunterService.java:30)
Main.doGet(Main.java:23)
javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)

有什么想法吗?我不是Hibernate的新手,但我相信我了解mapbyby概念,并且再次说明,它在本地运行时效果很好,但未部署到Heroku。

感谢您的见识

0 个答案:

没有答案