如何将这些实体类添加到持久化单元的聚光灯中?
我已经阅读了Hibernate手册,http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html#setup-configuration-packaging 我也看到了这些SO问题:
- How can I merge / extend persistence units from different JARs?
- define jpa entity classes outside of persistence.xml
- Programmatically loading Entity classes with JPA 2.0?
我的应用程序不使用Spring。 我不要求可移植性 - 我将坚持使用Hibernate。
- 有这样的解决方案吗?
- 是否有一种方法可以从
persistence.xml
创建PU并以编程方式添加类? - 在创建了
EntityManagerFactory
之后,我可以将@Entity类添加到其中吗?
更新:我在org.hibernate.ejb.Ejb3Configuration
中找到了:
public Ejb3Configuration configure(String persistenceUnitName, Map integration)