aspose file tools*
The moose likes Object Relational Mapping and the fly likes handling object restore on rollback Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "handling object restore on rollback" Watch "handling object restore on rollback" New topic
Author

handling object restore on rollback

fred funston
Greenhorn

Joined: Feb 21, 2004
Posts: 1
When you delete a user, for example, a large number of
objects that refer to the user will need to be updated also.
This all happens in a transaction. The objects will
get updated in memory before the database transaction
is committed.
How do you handle "restoring" the in memory objects when a
rollback in the database occurs?
The transaction context does not include objects so there
is no equivalent way of undoing all the changes that have
been made to objects.
The realistic solutions i can think of:
* restart the system so it reloads from the database
* don't use OO over relational
* map tables and objects 1-1, which defeats the purpose
Is there a better way?
Erik Bengtson
Ranch Hand

Joined: Dec 06, 2003
Posts: 90
a JDO implementation will restore your persistent objects on a simple configuration:
tx.setRestoreValues(true);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: handling object restore on rollback
 
Similar Threads
Abort Transaction
More Roundtrips or More Data (opinions plz)
transaction when multiple database connections are open
BMT/CMT and JDBC Transaction
How to handle transaction Rollback on Exception