I have read a half dozen blog entries concerning locking and unlocking records for update/delete operations. I'm beginning to understand the necessity for a locking cookie associated with a specific record number. The suggestion has been made that developers should create a HashMap<recNo, cookie>, and enter a key-value pair each time a record is locked. My question is the following:
If I understand correctly, the recNo in the HashMap<recNo, cookie> uniquely identifies the database record upon which an update/delete operation is going to occur. If I understand correctly, the cookie in the HashMap<recNo, cookie> uniquely identifies the client who has permission to perform an update/delete operation on the specific recNo. When the recNo and the lockCookie are passed as arguments to the update() method, the recNo identifies the record that will be updated and lockCookie identifies the client who has permission to perform the update.