Here's the full code:
public Object invoke(Invocation invocation) throws Throwable {
InitialContext initCtx = new InitialContext();
EntityManagerFactory emf =
(EntityManagerFactory)initCtx.lookup("java:/EntManager1Factory");
EntityManager em = emf.createEntityManager();
MethodCalledByMethodInvocation methodInvocation =
(MethodCalledByMethodInvocation)invocation;
try {
methodInvocation.getCalledMethod().invoke(methodInvocation.getTargetObject(),
methodInvocation.getArguments());
} catch (LazyInitializationException ex) {
Object tmpEntity =
em.merge(methodInvocation.getTargetObject());
methodInvocation.setTargetObject((methodInvocation.getTargetObject().getClass().cast(tmpEntity)))
}
return methodInvocation.invokeNext();
}
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4108544#4108544
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4108544
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user