1 Reply Latest reply on Oct 2, 2006 2:35 AM by mugwump

    Accessing EntityManagerFactory?!

    mugwump

      Is there a way to get hold of the EntityManagerFactory that produced an injected PersistenceContext?

      I use

      @PersistenceContext
      private EntityManager em;
      


      to inject a PersistenceContext - and I need the EntityManagerFactory from which this EntityManager was generated. Is there a simple way to do that (from a Stateless SessionBean or from an MBean?)

      cheers&thx
      stf


        • 1. Re: Accessing EntityManagerFactory?!
          mugwump

          ok, that was easy after I found

          @PersistenceUnit

          which injects the EntityManagerFactory (this also works on mbeans, and the persistence-unit is initialized before the mbean: so in case you want to do something fancy with the EntityManagerFactory, you can do so in the create() of an MBean...)