4 Replies Latest reply on May 8, 2009 3:47 AM by Erik Lindblad

    Annotating @persistencecontext from a different ear

    Erik Lindblad Newbie

      Hello!

      I'm trying to inject a persistencecontext in my ejb that is defined in another ear.

      Project setup:
      aaa.ear
      |-aaa-ejb.jar

      bbb.ear
      |-bbb-ejb.par.jar (defines the persistence unit)


      In aaa-ejb:

      // Needs to bind to:
      // persistence.units:ear=bbb.ear,jar=bbb-ejb.par.jar,unitName=MYPERSISTENCEUNIT
      // JBOSS BUG! (https://jira.jboss.org/jira/browse/EJBTHREE-1252)
      @PersistenceContext(unitName="XXXbbb-ejb.par.jar#MYPERSISTENCEUNIT")
      private EntityManager em;
      

      The above code is parsed to:
      persistence.units:jar=bbb-ejb.par.jar,unitName=MYPERSISTENCEUNIT
      

      I cannot figure out how to pass the correct EAR to the annotation. Any ideas?