hi,
when i try to use saveOrUpdateCopy, i've been getting a lazy initialization exception. the object that i'm trying to create has been added to a parent's collection which was loaded in another session. how can i correct this error, do i have to manually associate the parent object to the session with this method?
thanks, cam
Code:
net.sf.hibernate.LazyInitializationException: Failed to lazily initialize a collection - no Session
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:213)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:69)
at net.sf.hibernate.collection.Set.iterator(Set.java:131)
at net.sf.hibernate.type.PersistentCollectionType.copy(PersistentCollectionType.java:248)
at net.sf.hibernate.type.TypeFactory.copy(TypeFactory.java:284)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:3826)
at net.sf.hibernate.impl.SessionImpl.copy(SessionImpl.java:3784)
at net.sf.hibernate.engine.Cascades$5.cascade(Cascades.java:132)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:436)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:843)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:817)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:740)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:3808)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:3780)