-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to use forUpdateOfColumns() function
PostPosted: Mon Nov 27, 2006 10:42 am 
Newbie

Joined: Mon Nov 27, 2006 10:00 am
Posts: 1
Location: New Dlehi, India
Hi users,
I am new in this forum. Just joined this forum for hibernate related problems.

Can anybody here tell me how to use
Quote:
forUpdateOfColumns()
function.
My requirement is as follows:
Quote:
I want to lock a row in the DB while performinig some operation into DB. While doing so i want to make it sure that nobody from other session of oracle can update a column of that particular row. For that the oracle provides a keyword FOR UPDATE OF. I can simply do this thing using native HQL, but on internet i found some information that i can do this thing using forUpdateOfColumns function of Oracle9Dialect Class.


I have declared oracle.dialect in my hibernate configuration file.
Can anybody here help me out.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 10:58 am 
Regular
Regular

Joined: Tue Feb 24, 2004 11:42 am
Posts: 56
use
session.lock(myobject,LockMode.UPGRADE_NOWAIT)

then you modify the object as you wish.

Mind this pessimistic locking but is exactly what you want .

Please do rate.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.