File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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?
It's not a secret anymore!