0 Replies Latest reply on Apr 30, 2009 4:18 PM by joe blah

    catch staleobjectstateexception and retry?

    joe blah Newbie

      im trying to prevent this scenario:

      im trying to prevent:

      x=1

      t1 stores x as a1
      t2 stores x as a2
      t1 increments a1 from 1 to 2
      t2 increments a2 from 1 to 2
      t1 commits
      t2 commits

      the value should be 3 but ends up being 2

      should i use pessimistic locking with versioning, and then catch the staleobjectstateexception and handle retrying?