Direct Lookup to EntityManager does not work any more in EAP 6
Issue
- When trying to lookup the EntityManger using the following code in EAP 6:
// Not working in EAP 6
EntityManager em = (EntityManager)sessionContext.lookup("java:app/cpttel03");
- The jndi mapping is done like below in persistence.xml :
<property name="jboss.entity.manager.jndi.name" value="java:/cpttel03"/>
- Now the Entity manager could only be fetched using the following code:
//working in both EAP 5 and EAP 6
EntityManager em = ((EntityManagerFactory)sessionContext.lookup("java:global/" +
getInstance())).createEntityManager();
and
<property name="jboss.entity.manager.factory.jndi.name"
value="java:/cpttel03"/>
- Direct lookup to EntityManger was possible in EAP 5.
Environment
- JBoss Enterprise Application Platform (EAP)
- 6.0.1
- 6.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
