-->
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: Oracle pagination
PostPosted: Tue Dec 02, 2014 11:06 am 
Newbie

Joined: Tue Dec 02, 2014 10:50 am
Posts: 1
Hey there guys, I've been having issues with Oracle dialect pagination performance. Currently Hibernate uses rownum instead of invoking row_number() native function from oracle.
Is there any way for me to tell Hibernate to use native row_number() function?

Example:
1) What Hibernate is currently using:
Code:
select * from
   ( select row_.*, rownum rownum_ from
      ( select this_.* from Route this_ order by this_.id)
        )
   row_ where rownum <= 1500) where rownum_ > 5

2) What I wanted
Code:
select * from
   (         
      select this_.*, ROW_NUMBER() OVER (ORDER BY id) AS rn
         from Route this_ ORDER BY this_.id
   )
   where rn between 5 AND 1500


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.