0 Replies Latest reply on Apr 22, 2004 4:00 PM by darren hartford

    optimistic locking, finder/ejbselect/ejbstore(), and version

    darren hartford Expert

      Hey all,
      I've been attempting to get optimistic locking to work (think value-object pattern). This is what I have tried so far:

      @ejb.bean use-soft-locking="true"
      -looks like will be depreciated anyhow

      @jboss:optimistic-locking modified-strategy="true"
      -and
      @jboss:optimistic-locking
      version-column="true"
      column-name="version"

      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?
      -D