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")
userTx.begin();
pojob = ctx.lookup("pojob");
pojob.domystuff();
userTx.commit();
....
...
Any body that can confirm this is how it suppose to work?
/Flemming
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/533116#533116]
Start a new discussion in EJB 3.0 at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]