-->
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: query setLockMode function
PostPosted: Wed Mar 29, 2006 10:17 am 
Newbie

Joined: Wed Apr 13, 2005 11:25 am
Posts: 7
Hi,

I just want to clear something.
In sybase there is something "at isolation read uncommitted" you can use when executing a query to read pages even if locked.

While searching in hibernate for sucha behavior ,I have came accross "query.setLockMode(alias??? ,LockMode.NONE)"

What I need to find out is how to specify the alias for mulitple objects+the function i query with is generic ,thus accepting each time a different query string,so I can't predict the alias.

The documentation says :

alias a query alias, or this for a collection filter

I didn't quite get it !!!
Is there a way of specifying all objects . I don't care if my query returns not-uptodate objects.I just want to get the results even though there is an update lock on the table.

Besides I can't use transaction setMode because I use it for updating afterwards.

Thanks a lot.
Z


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 29, 2006 7:01 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
"this" is the root alias. However, it won't help you, as it does not do what you want: it's just used to specify that you want the default read type (with nolock) instead of locking it (using the "select .. for update" or whatever your DB's syntax is). There is no way to read items that are locked: you'll have to use an SQL query, or get the JDBC connection and do it manually.


Top
 Profile  
 
 Post subject: Improvement ?
PostPosted: Thu Mar 30, 2006 8:20 am 
Newbie

Joined: Wed Apr 13, 2005 11:25 am
Posts: 7
Ok, thanks

But however I think this should be submitted as an improvement ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 30, 2006 5:27 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Well, you could head over to the JIRA issue site (see www.hibernate.org for the link), but I'd expect it to be turned down. It's not really something that fits into hibernate's way of thinking. Hibernate won't lock rows for updating prematurely: if you have a massive update loop, no DB locks are acquired until you eventually flush. So the only time this is likely to be an issue is if some other app is writing to the DB. Still, no harm in trying, and I can't profess to know anything about the development team's vision for hibernate.


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.