Hibernate version: 2.1.6
[b]Full stack trace of any exception that occurs: net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no session or session was closed
void net.sf.hibernate.collection.PersistentCollection.initialize(boolean)
PersistentCollection.java:209
void net.sf.hibernate.collection.PersistentCollection.read()
PersistentCollection.java:71
java.util.Iterator net.sf.hibernate.collection.Bag.iterator()
Bag.java:256
com.tcs.cms.AreaVersion com.tcs.cms.Area.getVersion(java.lang.String)
Area.java:153
void com.tcs.cms.test.TestCmsSession.testArea1()
TestCmsSession.java:54
void com.tcs.cms.test.TestCmsSession.main(java.lang.String[])
TestCmsSession.java:20
[b]Name and version of the database you are using:Oracle 9.2
Hi I'm getting LazyInitializationException when I query an object that has a collection with lazy relationship, I close the session, I open a new session and try to query the same object and access the collection.
When I get the object in the new session and debug the collection the session associated with the collection is null. It seems that the object was put in the global cache and when I close and open the new session and query the object it was not associated with the new session.
Any help will be greatly appreciated.
Regards,
N
|