I’m working now with a JPA 2.0 project (in Eclipse Indigo). In my persistence.xml file I need to specify two <persistence-unit> tags, because I have two different database to work with. Doing this, I get the following warning:
Multiple persistence units defined – only the first persistence unit will be recognized
Even more, if I create my entities and put it in my second <persistence-unit>, I get an error saying that my entity isn’t declared in a persistence-unit:
Class “my.package.MyClass” is mapped, but is not included in any persistence unit
So, the question is: is possible to declare (and use them as expected) many <persistence-unit> tags in persistence.xml file? If yes, what do I need to do for getting the accurate behavior?
Thanks!
JPA does not limit number of persistence units defined in persistence.xml. This warning just tells about limitation of tool in Eclipse IDE. This is told for example here http://www.eclipse.org/webtools/dali/gettingstarted.php :
I guess there is no known way to get this work in Eclipse IDE.