2 Replies Latest reply on Jun 10, 2013 3:21 AM by aspide1985

    EntityManager lookup not dependency injection

    aspide1985 Newbie

      Hi,

      I've a problem with JBoss As 7.1.1.Final with entity manager lookup.

      I've to get the EntityManager ref via jndi lookup and not with dependency injection.

       

      Let me to explain:

      If I try to get EntityManager with

       

      @PersistenceContext(unitName="MyPersistenceUnit")

      private EntityManager entityManager;

       

      I haven't problem, but if I try to get EntityManager via lookup using jboss.entity.manager.factory.jndi.name (defined in my persistence.xml), I've, of course, the EntityManagerFactory reference, but I don't want It. I want the EntityManager ref that already exists.

       

      I saw it isn't possible to set jboss.entity.manager.jndi.name.

      So, any solutions?

       

      Regards Jonny.