我想利用JPA @Entity注释不要将类实体声明为J2SE persistence.xml文件.我想避免的:
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.mycompany.entities.Class1</class>
<class>com.mycompany.entities.Class2</class>
<class>com.mycompany.entities.Class3</class>
</persistence-unit>
Run Code Online (Sandbox Code Playgroud)
这是我的实际persistence.xml看起来很像
<persistence-unit name="test" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<properties>
<!-- Scan for annotated classes and Hibernate mapping XML files -->
<property name="hibernate.archive.autodetection" value="class, hbm" />
<property name="hibernate.cache.use_second_level_cache" value="false" />
<property name="hibernate.cache.use_query_cache" value="false" />
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
</properties>
</persistence-unit>
Run Code Online (Sandbox Code Playgroud)
是否有一种标准方法可以在JAR模块中扫描persistence.xml文件中的JPA实体?是否有一种不标准的Hibernate方法从JAR模块中扫描persistence.xml文件中的JPA实体?
有没有人对Hibernate OGM与Kundera的使用有反馈?我知道这两个框架正在为NoSQL解决方案提供Java持久性(JPA)支持,我希望从那些研究两者的人的经验中受益.听起来昆德拉支持更多的NoSQL DataSource.