I seem to have found a problem with replicating objects that contain uninitialized Hibernate-typed collections. For example, if I load an object server-side and return it to my client and call replicate() on that object, I will get the following exception if the object contains some collections that were uninitialized by the server (lazy collections)
Code:
java.lang.NullPointerException
at net.sf.hibernate.collection.Set.entries(Set.java:254)
at net.sf.hibernate.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:512)
at net.sf.hibernate.impl.ScheduledCollectionRecreate.execute(ScheduledCollectionRecreate.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2407)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2364)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2229)
at com.company.project.client.persistence.HibernatePersistenceFacade.storeObject(HibernatePersistenceFacade.java:221)
(etc)
looking at Hibernate's debug output, I see:
Code:
00:56:13,098 DEBUG [Printer] com.company.project.common.hibernate.User{password=casp, userName=casp, userId=483, roles=uninitialized, files=[], categories=[]}
If I explicitly set the uninitialized collection(s) to null, the problem goes away.
I can reproduce this behavior identically with both postgres and mckoi.
For some background on this post, please see:
http://forum.hibernate.org/viewtopic.php?t=930720thanks for your help.
Justin[/code]