0 Replies Latest reply on Dec 11, 2009 8:57 AM by Thomas Goettlich

    Entity in multiple persistence units

    Thomas Goettlich Novice

      In our application we have multiple persistence units to support master data that is shared between applications and application specific data.

      Previously, we had only one PU, so the entities are in the same jar.

      Because of other requirements, the persistence.xml is located in another jar and thus references the jar that contains the entities like follows:

      <persistence-unit
       name="PU1" >
      //config, e.g. connection to shared datasource
      <jar-file>
       ../entities.jar
      </jar-file>
      </persistence-unit>
      
      <persistence-unit
       name="PU2">
      //config, e.g. connection to app specific datasource
      <jar-file>
       ../entities.jar
      </jar-file>
      </persistence-unit>


      Is this a reasonable approach or should we expect problems due to persistence units potentially referencing the same entities?

      We're using Hibernate 3.3.2 on JBoss 4.2.3.GA.

      Thanks for your help.

      Thomas