File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate - Locking a record 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 » Databases » Object Relational Mapping
Bookmark "Hibernate - Locking a record" Watch "Hibernate - Locking a record" New topic
Author

Hibernate - Locking a record

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi,

I have reservation site, in that i have some set of numbers loaded in table. During reservation am fetching records one by one and updating the status as reserved.

While selecting the record am using a lock(for update) and then updating the status as reserved. In real time because of the load 2 diff threads picking the same record and second one is while update. since I have selected the record with lock.

Could someone please suggest is there any way I can restrict the record from the select which is already selected with lock..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Hibernate - Locking a record
 
Similar Threads
URLyBird - Locking "Catch 22"
Caching Records for "Bodgitt and Scarper"
Was the lock successful?
Row locking using oracle database
B&S: RandomAccessFile contains one file pointer?