1 Reply Latest reply on Sep 27, 2005 3:38 PM by Paul

    CMP, optimistic locking, multiple nodes, and  lost updates

    Paul Newbie

      This is the same issue as in thread http://www.jboss.com/index.html?module=bb&op=viewtopic&t=57315, but I did not see a solution.

      We are currently experiencing lost updates because of multiple nodes accessing the same record and then updating it. You know, the familiar lost update scenario.

      We have, in our testing environment, implemented optimistic locking (with Commit Option B, NoTxLock). Much of this has worked really well, and we get a JBossRollbackException as expected because of 0 rows affected. However, we want to catch the EJBException before it rolls back (so that we can reread the record and try the update again). Is there any way to do this? (Question 1)

      I saw in another thread that it was suggested to place the update code in a function that requires a new transaction, which I tried, but I could not get it to work (not saying it won't, I've just been unsuccessful so far). If this were to work, would the "parent" transaction roll back the "nested" transaction if some issue in the parent processing necessitated a rollback? (Question 2)

      If any one has successfully resolved this situation with CMP and multiple nodes causing lost updates, would you be so kind as to share how this was accomplished? (Question 3) I would think this is a fairly common issue, but I can't seem to find how this is being configured within JBoss.

      Thanks.