This content has been marked as final.
Show 1 reply
-
1. Re: PersistenceContext from XMBean or MBean
acoliver Jan 18, 2006 11:14 AM (in response to acoliver)This dirty hack seems to work:
try {
InitialContext ctx = new InitialContext();
session = ((EntityManager)ctx.lookup("java:/EntityManagers/mail"));
System.out.println("*********************looked up session and it is "+session);
} catch (Exception e) {
e.printStackTrace();
}
however I can't then use it as a straight HibernateSession, I have to used it as a EntityManager... This is okay though.. I'll think about making this into an aspect for AOP...