0 Replies Latest reply on Jun 26, 2009 5:46 AM by Miguel Angel Garcia Grande

    EntityManager through JNDI: Is it container managed?

    Miguel Angel Garcia Grande Newbie

      Hi all,

      I'm starting a development that will be deployed into JBoss. I'm trying to reuse a bunch of classes I'm currently using in a J2SE application. These classes do already use JPA and get EntityManager through a JNDI lookup.

      I don't want to convert them into EJB so I can keep reusing them.

      I have successfully obtained EntityManager through JNDI from within JBoss by adding the following line into "persistence.xml" file:

      <property name="jboss.entity.manager.jndi.name" value="java:/persistence/FondosEJB" />

      Just to make sure I'm getting the right EntityManager, I've System.out.println'ed both the injected one and the one I retrieve via JNDI... and they're not the same!!!

      Is this ok? Or does it mean that the one I get through JNDI isn't container managed or something?

      Thanks a lot for your help.

      Miguel Angel