2 Replies Latest reply on Mar 22, 2007 12:13 PM by Dustin Norlander

    getting EntityManager from within java?

    Dustin Norlander Apprentice

      Hi,

      How do i get the EntityManager from within a java method (i.e. without using @In)?

      I have tried:


      EntityManager manager = ((ManagedPersistenceContext)Contexts.getConversationContext().get("entityManager"))
       .getEntityManager();
      


      Which works some of the time (I assume only when the current conv holds an 'entityManager' reference).

      thanks
      Dustin