1 Reply Latest reply on Jul 17, 2008 5:26 PM by krenfro

    How do I use the same JPA entities in multiple applications?

    krenfro

      JBoss 4.2.2

      I have some JPA entities packaged in User-entity.jar with a persistence context named 'UserPU'. I include this User-entity.jar in an ejb.jar and deploy it. This works great and I can CRUD entities. Now I want to include the User-entity.jar in a separate application (ear or ejb-jar) and when deployed I get the following WARNING:

      13:29:37,778 WARN [ServiceController] Problem starting service jboss.j2ee:module=User-entity-0.1-test.jar,uid=1243449447,service=EJB3
      java.lang.RuntimeException: javax.management.InstanceAlreadyExistsException: persistence.units:unitName=UserPU already registered.
      


      Is it possible to reuse JPA entities in this way? Is it recommended?

      thanks!