-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Nested Unit of Work possible? (Saving persistence state)
PostPosted: Thu May 05, 2005 6:44 pm 
Newbie

Joined: Thu May 05, 2005 6:27 pm
Posts: 7
Toplink supports nested Unit of Work sessions, which come in
very handy to "undo" some persistence state changes.

Example:

(1) Create a new window and a new UoW, make some changes
to the object graph

(2) Create a dialog and a child UoW from the window's UoW,
make some more changes to the object graph

(3a) Press "Save" in the dialog -> changes in the child UoW are
merged into the parent UoW. No database yet, all in memory.

(3b) Press "Cancel" in the dialog -> changes in the child UoW
are thrown out, and the parent UoW is in the same state as before
the dialog was opened

Since Hibernate doesn't support this, I wonder if there is a way to
solve this problem in a similar fashion. Maybe something like this:

session.mark();
.... make some changes to objects, etc...
session.reset();

Calling session.reset() restores the persistence state to the time
session.mark() was called.

Hibernate could save the persistence state at mark(), and clear
it on commit(), flush(), or rollback().

Looking at the Hibernate 3.x source, serializing a Session object
also serializes the SessionFactory object. So mark() and reset()
could not be implemented by serializing the session to a buffer,
then later deserializing it from that buffer, right?

SessionImpl contains the PersistenceState object. Is it enough to
just serialize the PersistenceState object on mark(), then on
reset() deserialize it again?

How do others deal with this use case?

Thank's in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.