• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Lost update problem and web apps

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

Thanks!
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im not an expert.

If it is oracle you can lock a field from being modified by other while selecting the record.

select field_name1 from table_name for update of field_name1


if selected like this unless you commit other person cannot modify.So care should take to handle when conncetion is not released also.Hope this would have helped you
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic