2 Replies Latest reply on Dec 22, 2008 12:27 PM by adamw

    Getting entity manager

    adamw

      Hello,

      is it possible to retrieve the EntityManager when using JBoss Embedded? All of my EJBs and the persistence context is deployed: when I lookup an EJB, the entity manager is injected properly (with @PersistenceContext). But how to retrieve it from JNDI directly?

      --
      Adam

        • 1. Re: Getting entity manager
          alesj

          Dig through the code and check what the JNDI name is used? :-)

          Then a simple InitialContext::lookup should do.

          • 2. Re: Getting entity manager
            adamw

            Yeah, well, I took the easier approach of listing everyting in the root and java:/ namespaces but didn't find "EntityManager" there - so I posted here.

            But now I read the whole list and found "SessionFactory" - from which I can easily get EMF :)

            --
            Adam