-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: database-level locks
PostPosted: Mon Jun 07, 2010 10:01 am 
Newbie

Joined: Mon Jun 07, 2010 6:08 am
Posts: 2
hi,

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 works, as if another thread of the same instance uses the getCurrentLockMode function (on an object for the same db record using the get function) it return an LockMode.UPGRADE.
My problem appears when another instance ask the same data. I dunno how to check if it's in use.
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 :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.