Hibernate 2.1.4
I have an object 'A' which has a child object 'B' that is defined as a property. 'B' has a collection 'C' that is defined as lazy
I retrieve 'A' from a hibernate session, and the session is closed and 'A' "goes off and does some stuff"
Later 'A' is reattached to a "new" session with session.lock(A, LockMode.NONE) and I do 'B = A.getB()' and all is well
I then call 'B.getC()' and I get LazyInitializationException with "no session or disconnected session"
If I do session.lock(B, LockMode.NONE); after calling 'A.getB()' then I can call 'B.getC()' with no errors
I understood that if the parent object is reassociated with a session, so should the whole object graph? What am I missing?
|