Hibernate version: 2.1.8
FlushMode = on commit
Im trying to trace down an issue im having with deserializing the session.
The code is greatly simplified but produces the same sequence as the production code.
I do the following :
Code:
// Session is already open
// A is a mapped object
S.saveOrUpdate( new A() );
// verify the session is dirty
assert( S.isDirty() );
// disconnect the session ( as we cant serialize a connected session )
S.disconnect();
// Serialize the session
Object state = doSerialize( S );
// Deserialize the session
S = (Session)doDeserialize( state );
I get a deserialization problem ( InvalidObjectException ) from net.sf.hibernate.impl.SessionImpl.Status. A status of "SAVING" was serialized out, but the readResovle doesnt allow that value to be read back in.
If i comment out the assert it works just fine (as no entity with state SAVING is serialized).
Is there some way to work around this?
Effectivly what i am doing is a long transaction by doing operations on a flush on commit session that is deserialized, modified based on the users input, disconnected and serialized into user state. IsDirty is used to determine if the user has made any changes (net of all the edits they have done. Ie changing a property then puting it back nets to no change). Then at some point the user indicates that they either want to discard all they have done or save it.