I've been attempting to get optimistic locking to work (think value-object pattern). This is what I have tried so far:
-looks like will be depreciated anyhow
I would like to see a version field that gets incremented only when the data is changed (i.e. a 'setXXX' is used). The use-case is the value-object pattern where multiple value objects may be out at one time, one value-object may changed and allow it to update the data if it hasn't been previously changed.
Instead, I'm getting incrementation every time a finder or an ejbSelect is being called. This breaks the value-object pattern as if I get the first object to read, no prob. Get second object to read, no prob. Send a change to the first object back - breaks as since the second object was retrieved via finder and NOT changed, the version field is still incremented and the first object can't update changes as it things the data it had is stale.
Any ideas please?