[jboss-user] [EJB 3.0] - Re: Local JNDI name for EntityManager?

chamillard do-not-reply at jboss.com
Fri Feb 16 13:30:54 EST 2007


(I'm not the original poster, but I'm having the same problem)

Although I'm using 4.0.4.GA, I tried this by adding the following to my persistence.xml

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

I then tried to do a JNDI lookup using 

Context ctx = new InitialContext();
  | EntityManager em = (EntityManager) ctx.lookup("java:CoreEntitiesEntityManager");
  | 

but I got the "standard" (at least for me)

javax.naming.NameNotFoundException: CoreEntitiesEntityManager not bound 

exception when I ran the code.

Does the recommended approach only work in 4.0.5.GA (and not 4.0.4.GA)?
Does it matter that I'm doing this in a Cactus test case?
Isn't there a default JNDI name for an entity manager for a deployed persistence unit? If so, what would the full name be (assuming the app is deployed in "MyApp.ear", with persistence unit name "mypersistenceunit")?

Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017800#4017800

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017800



More information about the jboss-user mailing list