Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handling object restore on rollback

 
fred funston
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a JDO implementation will restore your persistent objects on a simple configuration:
tx.setRestoreValues(true);
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic