I would appreciate advice on how to deal with the lost update problem in a web application.
Suppose we have a web app in which one page lists employees and, if a user clicks on one particular employee in the list, that employee's record is retrieved from the db and displayed on another page. The user may modify some fields on this second page and then submit the page to save the changes to the db.
If two user's both retrieve the same employee's record, update some fields on the update page and submit that page, then the last person's submission will overwrite the changes made by the first user.
How can I prevent the second user from being able to retrieve an employee's record if another user has already retrieved it, yet not submitted his update yet -- or at least not let the second user's update take effect?