This content has been marked as final.
Show 4 replies
-
1. Re: HttpSessionListener
liudan2005 Mar 16, 2006 11:37 AM (in response to udo.krass)you can't inject EntityManager your listener is tirggered.
Using jndi to lookup your EntityManager would solve your problem. -
2. Re: HttpSessionListener
udo.krass Mar 16, 2006 3:11 PM (in response to udo.krass)Thanx,
do you know the JNDI-Name of the EntityManager in EJB3?
I only found java:comp/Entitymanager in old specs... -
3. Re: HttpSessionListener
shane.bryzak Mar 16, 2006 3:25 PM (in response to udo.krass)Configure the following property in your persistence.xml:
<property name="jboss.entity.manager.factory.jndi.name" value="java:/EntityManagers/MyEMFactory"/>
Then to lookup the entity manager:InitialContext ctx = new InitialContext(); Object factory = ctx.lookup("java:/EntityManagers/MyEMFactory"); manager = ((EntityManagerFactory) factory).createEntityManager();
-