RE: transactions, row locking, race condition?

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Mon Apr 11 2005 - 10:36:44 EDT

  • Next message: Pirola Davide: "Change cayenne.xml name dynamically"

    That should be a try/cATCH block ... I'm going back to my caffeine
    source now ...

    -----Original Message-----
    From: Gentry, Michael (Contractor) [mailto:michael_gentr..anniemae.com]

    Sent: Monday, April 11, 2005 10:29 AM
    To: cayenne-use..bjectstyle.org
    Subject: RE: transactions, row locking, race condition?

    Wrap your dataContext.commitChanges() call in a try/commit block. This
    will probably need to be in some kind of loop so you can try to go grab
    a new record to work on if you get an exception.

    /dev/mrg

    -----Original Message-----
    From: Tore Halset [mailto:halse..vv.ntnu.no]
    Sent: Monday, April 11, 2005 9:10 AM
    To: Cayenne mailing list post
    Subject: Re: transactions, row locking, race condition?

    On Apr 11, 2005, at 15:05, Tore Halset wrote:

    > Using optimistic locking cayenne will create a sql update statement
    > like:
    > update candidates set my_timestamp='2005-04-11' where id=17 and
    > my_timestamp is null;

    Sorry, I was a bit short here.. If that sql does not update any rows a
    OptimisticLockException should be thrown.
    http://www.objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
    access/OptimisticLockException.html

      - Tore.

    > "my_timestamp is null" is caused by the optimistic locking and is used

    > to make sure the row has not been modifyed by another client.
    >
    > http://www.objectstyle.org/confluence/display/CAY/
    > Optimistic+Locking+Explained



    This archive was generated by hypermail 2.0.0 : Mon Apr 11 2005 - 10:36:50 EDT