This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Help Record Lock? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Help Record Lock?" Watch "Help Record Lock?" New topic

Help Record Lock?

Patrick Wang

Joined: Oct 15, 2001
Posts: 20
I have some question about client lock?
From complete Java 2 certification book, it talked about 3 different method of record locking?
1) Active Client-- locking record when row highlighted
2) On demand Client-- lock is integral to all add/delete/modify operations.
My question is when you use on demand client locking, how can you
prevent dirty/update, say one client update record N, released the lock, then the second client update the same record N, overwrite the update that the previous client made. I know you can have a timestamp field lastupdatetime for each record so
the second client update will fail. But it seems a little complex, just curious is there any better clean design out there
resolve this issue?
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Well spotted. The solution is a lot simpler, fortunately; after locking the record, re-read it so you have fresh data. Then, if the necessary seats are still available, modify the record and write it back.
- Peter
I agree. Here's the link:
subject: Help Record Lock?
Similar Threads
Help on this locking scenario
NX: cacheless design to keep things simple?
URLyBird - Locking "Catch 22"
Clarification of the lock mechanism.
DB Access Question