Hi,
Dispatching entities in different modules is not really easy with Hibernate/JPA, so I need your help.
For people using Spring, there is a common tweak to do this (
http://ancientprogramming.blogspot.com/ ... s-and.html), but it don't work anymore with Hibernate 3.5 (
http://opensource.atlassian.com/project ... e/HHH-4864).
I raised this point on Hibernate dev list, and would like to continue the discussion here. Emmanuel Bernard answer me that :
Quote:
Splitting entities amongst several JARs is definitely supported by JPA 2, you need to use the <jar-file> element in persistence.xml (or to a lesser extend <class>).
Merging several persistence.xml and considering them one is not a concept that makes sense in the JPA 2 spec. Conceptually that means a lot of metadata duplication that can and will conflict.
The exception you see comes from the fact that your "merging" does not "unduplicate" jar file urls and it's associated root url.
For my user point of view :
jar-file is not usable in real life, mainly because when you activate m2eclipse workspace resolution, mylib.jar change to file:.../mylib/target/classes
I want to keep a single Datasource, EntityManager and TransactionManager, so in my need one PU is good
I want to allow people to add Entities just by adding a JAR in the classpath (plugin way). Since I don't know Entity classes names when providing the core of my app, I can't use <class>
It seems JPA2 don't offer a solution for this (common) need when you are building multi modules applications
Has somebody a workaround for this issue with Hibernate 3.5 ?