Optimistic Locking

From: viki <vikash_at_dog.com>
Date: 8 May 2003 09:12:28 -0700
Message-ID: <f01186ed.0305080812.7808870f_at_posting.google.com>


While working on a web-based application, there is no straight forward means to lock records. The reason for this is the statelessness of web based applications. The web browser sends a request and the web server responds to the request. The transaction is restricted to this duration and all locks holds only within this transaction.

The only way in which you can achieve locking in such a system is by what is called as optimistic locking, where you maintain a time stamp column (date and time of last update) in every table. When a page is requested, the date and time of last update of the record is also sent. Now, when the user updates the record, check if the time stamp of the record has changed. If yes you can throw an error.

I guess this should work in you case as well.

Cheers
Viki Received on Thu May 08 2003 - 18:12:28 CEST

Original text of this message