I'm seeing a really strange error.
I basically do this:
pojo = getSession().load(getPersistentClass(), id);
Hibernate.initialize(pojo);
Hibernate.initialize(pojo.getChild());
Hibernate.initalize(pojo.getChild().getCollection());
.... etc .. to initialize the object graph so that I can evict a pojo and use it throughout ajax requests..
This error happens when a page initalized and then the initialize is run again after some ajax requests have called.
After investigating, it appeared that the pojo was serialized and thecollections were detached..
But if I thought that the getSession().load() should give me an attached pojo and with the entire graph attached...
Code:
Caused by: org.hibernate.HibernateException: collection is not associated with any session
at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:471)
at org.hibernate.Hibernate.initialize(Hibernate.java:332)
at com.conducive.data.pojo.Link.hibernateInitialize(Link.java:646)
at com.conducive.data.pojo.LinkPartner.hibernateInitalize(LinkPartner.java:178)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
at com.conducive.data.pojo.LinkPartner_$$_javassist_30.hibernateInitalize(LinkPartner_$$_javassist_30.java)