I'm looking for a way to get an EntityManager into a POJO running in Glassfish. I'd like to do the lookup via JNDI but can't seem to find a way to get GF to provide an EntityManager.
The app is a collection of EJBs, POJOs, and Entities. There is no web tier.
I've tried this:
try {
Context ic = (Context) new InitialContext();
this.em = (EntityManager) ic.lookup("java:comp/env/persistence/em");
} catch (NamingException ne) {
throw new MorissRuntimeException("Problem obtaining EntityManager", ne);
}
but no luck. Any ideas or suggestions?
Thanks,
-zach
[Message sent by forum member 'euqaz' (euqaz)]
http://forums.java.net/jive/thread.jspa?messageID=337824