实体在多个罐中时出现未知实体异常

Vic*_*cky 4 hibernate jpa-2.0

运行Maven测试时出现此异常。

错误-无法部署应用程序:classpath.ear org.apache.openejb.OpenEJBException:创建应用程序失败:classpath.ear:org.hibernate.AnnotationException:net.atos.wlp.cns.core.record上的@OneToOne或@ManyToOne .ClearingRecord.clearingBatch引用未知实体:net.atos.wlp.cns.core.record.ClearingRecord.clearingBatch上的未知实体net.atos.wlp.cns.core.batch.ClearingBatch:@OneToOne或@ManyToOne引用未知实体:net org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:658)的.atos.wlp.cns.core.batch.ClearingBatch

我在persistence.xml文件中尝试了&选项,仍然存在该错误。

如果有人遇到类似问题,请帮助我。

Nik*_*iko 5

我有一个类似的问题-通过使我的实体分布在多个jar文件中。我也用过Maven ...

最初,我可以通过将jar文件提取到类中来使其运行。最后,解决方案是在persitence.xml中指定依赖项的jar文件:

    ...
    <persistence-unit ...
    <provider>...</provider>
    <jar-file>WEB-INF/lib/my-jar-file-0.0.1-SNAPSHOT.jar</jar-file>
    <properties>
    ...
Run Code Online (Sandbox Code Playgroud)