-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate LockMode
PostPosted: Wed Sep 29, 2004 6:31 pm 
Newbie

Joined: Thu Mar 04, 2004 3:55 pm
Posts: 8
Hibernate version: 3.0

Name and version of the database you are using: Firebird 1.5.1 on Windows 2000


Hi,

I want to get and lock a record using
session.get(Item, LockMode.UPGRADE)

even so, if I start my application in
other machine on net,
I can read the Item that should be locked.

Should not this impede the reading of this Item?

Thanks,

Douglas Granzotto
Lages/SC - Brazil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 6:33 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, this is a row level exclusive lock (in Oracle), preventing concurrent writes. Check your database documentation for the behavior of "select ... for update".

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 7:00 pm 
Newbie

Joined: Thu Mar 04, 2004 3:55 pm
Posts: 8
is there an way to impede the reading of an record while it is updated ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 29, 2004 9:47 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Check the Oracle documentation, what you need is probably a session.connection().createStatement("lock table foo in share mode") or something similar. This will kill your performance and have a real impact on scalability, of course. Make sure you understand what you are doing.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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