On 11/1/05, Murray Collingwood <[EMAIL PROTECTED]> wrote: > The scenario is very simple: > > 1. User A clicks an "edit" option to edit a record. > 2. While user A is editing the record user B clicks the same "edit" option > 3. Both users are now editing the same record (or so they think) > 4. User A clicks "save" and the record is updated and displays the changes > made by > user A - user A is happy > 5. User B clicks "save" and these changes overwirte the changes made by > user A, > however user B doesn't know this and the changes made by user B appear.
Trying to hold real database-level record locks from a web interface is just asking for trouble. The user wanders away, the connection drops... meanwhile, no one else can get to that record. I'm in a situation where I have to work around a telnet app that thinks it is the only thing accessing the database. I calculate a checksum when I read a record, and then check again before writing the record back. If the checksum has changed, then someone else touched the record (most likely from the telnet interface) and the web-user loses. This happens in the data access layer, Struts doesn't know anything about it other than being configured to handle a RecordModifiedException. -- Wendy