3 Replies Latest reply on Jul 25, 2012 10:06 AM by aneh

    Multiple JPA projects - one persistence.xml - can not be done?

    aneh

      To slightly expand the subject line.  I have multiple JPA projects all created via JBoss Tools in eclipse 3.7 (Indigo), each JPS has it's own persistence.xml file each with a unique persistence unit definition so there should be no conflicts between the jars..  The spec says that you may reference multiple jpa jars by using the <jar-file> element in persistence.xml.  So I have a problem, via the magic og JBoss Tools the location of the generated jar is unknown, although I am sure that someone out there can tell me where they are relative to either the workspace or the individual project.  However it I define the jar location as it is when deployed the development environment shows errors indicating that the imported JPA classes are not Entity(s).  That is they are not part of the JPA knowledge of the current project.

      I know this is somewhat of an edge case but it is something I have wanted to do for a long time.  I have a large number of self contained subject areas(i.e. discrete JPA jars) previously I did not have the time to resolve this issue and simply copied the same JPA class into as many projects as I needed - bad practice.  Now I want to really have a nice modular solution where I can build once and include every where (not copy everywhere).

      To offer a little more rationale I have a Person JPA, a Customer JPA , and a Supplier JPA project.  Currently I have to copy all of the files into a single JPA project to create a solution.  Not so bad you say!  If you only have a single client you are right.  However I have a number of clients all have these 3 JPA classes in common.  So to reduce the copy and paste activities whenever an update is made I would like to find a solution for my problem.