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?
posted 11 years ago
a JDO implementation will restore your persistent objects on a simple configuration: tx.setRestoreValues(true);