I am not sure what the most appropriate way to handle JPA objects that are shared using a JAR file to multiple projects. ie If you have multiple projects that all have an Employee
and Contact
and Address
objects, and you want to put them in a JAR file, how does this work. ie
Employee.jar
jpa/EMF.class
jpa/Employee.class
jpa/Contact.class
jpa/Address.class
jpa/Organisation.class
META-INF/persistence.xml
Project 1
src/jpa/EMF.java
src/jpa/BlogEntry.java
src/jpa/Comment.java
src/META-INF/persistence.xml
lib/Employee.jar
Project 2
src/jpa/EMF.java
src/jpa/Stock.java
src/jpa/Transaction.java
src/META-INF/persistence.xml
lib/Employee.jar
How does this work, is it ok to have two persistence.xml files like above? ie One for describing the JPA classes in the Employee.jar file, and another one for the project specific JPA classes?
Also, the Employee.jar file should not specify the JDBC url, as each project will be using a dfiferent database or schema. If the JDBC connection properties are only specified in the projects src/META-INF/persistence.xml will the Employee.jar classes pick up those settings?