Results 1 to 1 of 1
Thread: Hibernate database level lock
- 06-09-2010, 01:32 PM #1Member
- Join Date
- Jun 2010
- Rep Power
Hibernate database level lock
i don't understand how to check the lock on database rows.
i got a postgresql server which a java desktop aaplication is requesting.
let's suppose a part of my code is like this :
Person p = mySession.getCurrentSession().load (Person.class, 5, LockMode.UPGRADE);
this work perfectly the person of id 5 is loaded and an upgrade lock is created, i can see it as if another thread of the same instance use the getCurrentLockMode function (on an object for the same db record using the get function)
My problem appears when another instance ask the same data. I dunno how to check if it's in used.
This other instance clearly know the data is locked as it will standby on the Person p = mySession.getCurrentSession().load (Person.class, 5, LockMode.UPGRADE); line, until the first instance remove its lock.
i would like to be able to check instead of just waiting, there i can tell the user "one of your colleague is currently editing this data, please try again later".
Thanks for any tips :)
- By nonabhai in forum NetBeansReplies: 9Last Post: 05-21-2010, 12:08 PM
- By liljejalil in forum JDBCReplies: 1Last Post: 02-28-2010, 04:11 AM
- By mfaizan24 in forum New To JavaReplies: 7Last Post: 06-23-2009, 09:18 AM
- By Marty in forum JDBCReplies: 3Last Post: 12-23-2008, 01:57 PM
- By leonus in forum JDBCReplies: 0Last Post: 06-04-2008, 01:24 PM