-->
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: Session.get ignore LockMode.PESSIMISTIC_WRITE
PostPosted: Sun Aug 05, 2012 7:57 am 
Newbie

Joined: Sun Aug 05, 2012 7:44 am
Posts: 2
Hi,

I faced with inconsistency.
I open transaction and select object with Session.get(id, LockMode.PESSIMISTIC_WRITE).
Hibernate picks from loader map EntityLoader object.
It doesn't override method applyLocksToSql defined in base class Loader.

The default implementation of the method just returns its argument.

Therefore Dialect.getForUpdateString is not called.

If I use Session.list then all right because this method uses another loader - CriteriaLoader.

Session.load is the same to get.

I don't think that it's a bug because I have hibernate 3.6.1.Final and I don't do any extra specific actions.

Please, answer why has been such decision done and what should I do when I want pick locked object by its id?
Why does Session.get take lock mode argument and don't use it?


Daneel Yaitskov


Top
 Profile  
 
 Post subject: Re: Session.get ignore LockMode.PESSIMISTIC_WRITE
PostPosted: Sun Aug 05, 2012 8:50 am 
Newbie

Joined: Sun Aug 05, 2012 7:44 am
Posts: 2
I went futher. Session.list also ignores LockMode!

From a debugger I got:

CriteriaQueryTranslator.getQueryParameter forms lock mode for the query.
It create new object LockOptions. It has field lockMode. By default it contains NONE.

But the method never calls it and always passes lockOptions with lockMode is equal to NONE
to QueryParameters object.


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.