3 Replies Latest reply on Sep 28, 2006 10:40 AM by Georges Berscheid

    Multiple Persistent Units

    mleichter Newbie

      In my application i have a coredb.jar with all basic entities and a persistence.xml including a persistent-unit "core-db". In my second jar (myapp.jar) there are my specific entites and a persistence.xml with a persistent-unit "app-db". My app specific entites have an one-to-one memeber to a core-entity.
      Both jars are packed into one ear. When deploying i the following exception:

      org.hibernate.AnnotationException: @OneToOne or @ManyToOne on app.AppBean references an unknown entity: core.CoreBean

      Whats wrong? Can anyone help me? Thanx

        • 1. Re: Multiple Persistent Units
          Achim Hilwers Newbie


          I can't really help you but I have a similar problem. Somewehre in this forum I have read that it does not work if the ejbs are in different persistence-units.
          I have two jars, too, but I use the same persistence.xml in both jars, so I think I should have the same persistence-unit for the ejbs in both jars. Anyway I get the error message "...references an unknown entity...".

          Is there a workaround for this problem?


          • 2. Re: Multiple Persistent Units
            Ivan Nik Newbie

            core.jar, 1.jar, 2.jar
            and 1 persistence-unit
            I get the error message "...references an unknown entity..." too

            • 3. Re: Multiple Persistent Units
              Georges Berscheid Newbie

              I believe it doesn't work if you're using 2 different persistence contexts. It would try to join tables that aren't in the same database which is not possible.

              On the other side, I would like to deploy entity beans that depend on eachother but which ARE NOT packaged in the same jar (but possibily within the same ear).
              Any ideas how that would go?