This content has been marked as final.
Show 3 replies
-
1. Re: How to get an EntityManager or EntityManagerFactory usin
peterj Oct 2, 2009 11:42 AM (in response to marcos_aps)You can use the JNVIView mbean to see all of the names in JNDI.
http://www.jboss.org/community/wiki/DisplayTheJNDITreeWithTheJMXConsole -
2. Re: How to get an EntityManager or EntityManagerFactory usin
marcos_aps Oct 2, 2009 12:59 PM (in response to marcos_aps)"PeterJ" wrote:
You can use the JNVIView mbean to see all of the names in JNDI.
http://www.jboss.org/community/wiki/DisplayTheJNDITreeWithTheJMXConsole
I have done some research on this topic and I had to do this to get an EntityManagerFactory using JNDI:
In my persistence.xml:<properties> <property name="jboss.entity.manager.factory.jndi.name" value="java:/persistence/solicitacoes" /> </properties>
Now I can use the code:EntityManagerFactory emf = (EntityManagerFactory) new InitialContext().lookup( "java:/persistence/solicitacoes"); EntityManager em = emf.createEntityManager();
Is this the "official" way or is there a simple one?
Marcos -
3. Re: How to get an EntityManager or EntityManagerFactory usin
peterj Oct 2, 2009 3:42 PM (in response to marcos_aps)Yes, that is the official way.