1 Reply Latest reply on Jan 21, 2006 4:30 PM by Gavin King

    persistence.xml

    Matthew Edwards Newbie

      I have two ejb3 jars (eg. project.jar and example.jar) and they both have Seam components and ejb3 entities in them.

      Do I need persistence.xml files in both of them?
      Do I give the entity managers different names or can I give them the same name?
      If I have an entity in one jar can it have relationships with entities in another jar?
      When Seam makes up its components does it treat the two jars as though they were just one jar?

        • 1. Re: persistence.xml
          Gavin King Master

          I'm not the packaging expert here, so you would need to refer to what the spec says on this, and then cross your fingers that our current implementation conforms to that. (I would guess it probably does not yet support all packaging options available in the spec.)

          See section 6.2 of the persistence spec.

          My understanding is that:

          * If you want to share a persistence unit between multiple EJB3 jars, you would define the persistence.xml in the root of the EAR instead of the EJB3 jar. This would let you share it across all jars.

          * It would be best to make sure that PUs have different names, but this is not a requirement

          * You can (only) have associations between entities in the same PU. The actual jar is irrelevant.

          * Seam does not care. A Seam "instance" is scoped to a war.