Optimistic lock

#1

Hello

When I get an optimistic lock on an object, refresh(), start trans and persist?  Will the changes made to the object before the violation be retained or must they be duplicated in the retry code?  Assuming it affects only one object.  tia.

#2

The exact situation that you describe is unclear. Could you please clarify it with an example?

ObjectDB Support
#3

Hello

It is more abstract than code based.

I have retrieved an object under a pm, modify the object and I want to trap optimisticLocking exception.  In the retry code after the exception can I assume the changes I made to the object in memory are retained and I simple need to create a new transaction, persist and commit the object?  Or do I need to refresh() the object start a transaction, reapply the changes,persist and commit?

#4

By default, objects after transaction failure (regardless of cause) retain their values in memory.

Objects can be restored (to the values in database) by setting the JDO "javax.jdo.option.RestoreValues" property.

ObjectDB Support

Reply