【发布时间】:2014-08-16 04:57:31
【问题描述】:
我在我的项目中使用带有 JPA 的 Hibernate 4.3.6.Final 和带有 Java 配置的 Spring 4.0.6.RELEASE。
我有两个 jar 文件。模块1.jar 和模块2.jar。 module1.jar 有一些实体 和 module2 有一些实体。我不能使用 module2.jar 中的 module1.jar 实体而不使用 persistent.xml 和
<jar-file>module1.jar</jar-file>
是否有必要像我使用的那样拥有persistent.xml
entityManagerFactoryBean.setPackagesToScan("com.mydomain") 扫描所有 jar 文件中的所有实体。
【问题讨论】:
-
感谢您的回答。我在我的代码中发现了错误。我在 entityManagerFactoryBean.afterPropertiesSet(); 之后设置 packagesToScan;方法
标签: java spring hibernate jpa persistent