Yes, I am doing the following in a transaction:

1) SELECT the record which is to be updated
2) compare timestamps of the newly read record and the one passed down
3) IF timestamps are equal (ie nobody else has updated the record in the meantime) THEN UPDATE the record as per passed object setting the timestamp to current time.



The above transaction will not be water-tight if the SELECT isn't a SELECT FOR UPDATE. Only a SELECT FOR UPDATE will lock the record. If the record isn't locked, it could be modified/deleted in another session between steps 1) and 3).



Regards,


Tarlika Elisabeth Schmitz


Dave Newton wrote:
On Fri, 2004-04-23 at 11:22, T E Schmitz wrote:

Is there any means of doing a SELECT for UPDATE, ie to lock a record in a transaction?


Can you just do the entire operation in a transaction using the Torque
transaction methods?


http://db.apache.org/torque-31/apidocs/org/apache/torque/util/Transaction.html

HTH,
Dave




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to