0 Replies Latest reply on Jul 6, 2016 6:09 AM by anhgun

    Bind EntityManager to JNDI JPA/Hibernate

    anhgun

      Because ours application have many dependent jar and many entity in each jar component (without use .ear for all application). I can not use inject @PersistenceContext to use common EntityManager for all Entity of jars. I use one peristence.xml to list all Entity in all jar. Then configure bind EntityManager to JNDI with hibernate in peristence.xml :

       

       

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

       

       

      Then i can call EntityManager by JNDI. But i don't know how to bind entityMananger with "PersistenceContextType.EXTENDED" to JNDI. Or others solution to call EntityManager common for all jar in EJB without use JNDI call. I try with @PersistenceContext(entityManager#xyz.jar) but entityManager is always null. Thanks you for help