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