-->
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: force hibernate to use offset query when offset is 0
PostPosted: Mon Apr 30, 2007 4:01 am 
Senior
Senior

Joined: Sat Nov 27, 2004 4:13 am
Posts: 137
Hibernate version: Core 3.2.2 ga + Annotations 3.3.0 ga
Name and version of the database you are using: Oracle 10g r2

the following is the query hibernate generates with offset and limit in oracle 10g:

Code:
select * from (
select row_.*, rownum rownum_ from ( /* criteria query */ select this_.id as id0_0_, this_.code as code0_0_, this_.description as descript4_0_0_, this_.priority as priority0_0_, this_.title as title0_0_, this_.fk_lkt as fk1_0_0_ from cmn.tb_lookup this_ where this_.fk_lkt='province' ) row_ where rownum <= ?
) where rownum_ > ?


and when the offset is zero the following query is generated

Code:
select row_.*, rownum rownum_ from ( /* criteria query */ select this_.id as id0_0_, this_.code as code0_0_, this_.description as descript4_0_0_, this_.priority as priority0_0_, this_.title as title0_0_, this_.fk_lkt as fk1_0_0_ from cmn.tb_lookup this_ where this_.fk_lkt='province' ) row_ where rownum <= ?


the result of executing second query, and first query with last parameter equals by zero is different (different rows are returned by oracle); it seems that this is a Oracle's problem, is there any way to force Hibernate to use offset part of query when offset is zero.

_________________
don't forget to credit!

Amir Pashazadeh
Payeshgaran MT
پايشگران مديريت طرح
http://www.payeshgaran.co
http://www.payeshgaran.org
http://www.payeshgaran.net


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.