-->
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.  [ 3 posts ] 
Author Message
 Post subject: locking a table
PostPosted: Tue Jul 11, 2006 5:25 am 
Newbie

Joined: Wed May 31, 2006 8:58 am
Posts: 6
Location: Netherlands
Hi,

Is there anyway i can tell hibernate to lock the table it's reading? i don't want any other transactions doing an insert or update on the table when the transaction owning the lock is still active.

please , any help would be appreciated..

Thanks

Max


Top
 Profile  
 
 Post subject: Query q = session.createQuery("from ApplicationState
PostPosted: Tue Jul 11, 2006 6:14 am 
Newbie

Joined: Tue Sep 27, 2005 11:03 am
Posts: 6
Query q = session.createQuery("from Entity as entity");
q.setLockMode("entity", LockMode.UPGRADE);

(see setLockMode for more help)

Rob

_________________
Rob Kirkbride


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 11, 2006 9:06 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Yes, or
Code:
session.lock(enEntity, LockMode.READ); //for example


http://www.hibernate.org/hib_docs/v3/re ... e-detached

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


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

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.