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.
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.
The exact situation that you describe is unclear. Could you please clarify it with an example?
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?
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.