[jboss-user] [EJB 3.0] - I'm having a hard time with this error "org.hibernate.LazyInitializationException: failed to lazily initialize"

Flemming Harms do-not-reply at jboss.com
Sat Mar 20 05:09:05 EDT 2010

Flemming Harms [http://community.jboss.org/people/fharms] replied to the discussion

"I'm having a hard time with this error "org.hibernate.LazyInitializationException: failed to lazily initialize""

To view the discussion, visit: http://community.jboss.org/message/533116#533116

I found a solution to my problem. But I'm a bit unsure if this how it suppose to work.

So it turned out when I call a PojoB from PojoA the transaction that was started is not propagate to PojoB(which i thought) and therefore it start a new that is complete separated from the main transaction. But if I lookup the transaction manager through jndi in PojoA before I call the PojoB I can manual start a transaction and then it seems to be running inside the main transaction
UserTransaction userTx = (UserTransaction) ctx.lookup("UserTransaction")
pojob =  ctx.lookup("pojob");   
Any body that can confirm this is how it suppose to work?



Reply to this message by going to Community

Start a new discussion in EJB 3.0 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100320/cf2176f6/attachment.html 

More information about the jboss-user mailing list