-->
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.  [ 1 post ] 
Author Message
 Post subject: addQueryHint puts it into a wrong place
PostPosted: Thu Jan 22, 2015 11:02 am 
Newbie

Joined: Thu Jan 22, 2015 10:52 am
Posts: 1
If you use setMaxResults() method on a hibernate Criteria, hibernate creates a sub-query like

select *
from ( select this_.TRANSACTION_ID as TRANSACTION_ID1_18_1_, this_.VERSION as VERSION2_18_1_, this_.TRANSACTION_TYPE as TRANSACTION_TYPE3_18_1_, ...
from PMT_TRANSACTION where modification_date>... )
where rownum < 2000

and when you do addQueryHint(), it adds it on top instead of the sub-query:

select /*+ INDEX(this_ PMT_TRANSACTION_ID8) */ *
from ( select this_.TRANSACTION_ID as TRANSACTION_ID1_18_1_, this_.VERSION as VERSION2_18_1_, this_.TRANSACTION_TYPE as TRANSACTION_TYPE3_18_1_, ...
from PMT_TRANSACTION where modification_date>... )
where rownum < 2000

This way, the hint has no effect. It needs to be put into the sub-query. Looks like a bug to me. Any ideas if there is a work-around ?


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

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.