-->
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: problem with pagination and order on DB2 8.2
PostPosted: Thu Nov 16, 2006 9:50 pm 
Newbie

Joined: Thu Nov 16, 2006 9:38 pm
Posts: 1
Hibernate version: 3.0.5

I tested a simple query with pagination on DB2 8.2. If there is no order, everything goes ok. But when I added order, Hibernate generated wrong sql. In the trace, I found that Hibernate used DB2's 'rownumber() over( ... ) ' to implement the pagination, but if there is 'order by', the DB2 dialect copy the 'order by ...' subclause to the 'over (... ) ' function, and then the problem happens, for that in over() function, DB2 does not allow column alias. For example , this sql is corret on DB2:

Code:
select column1 as c1, rownumber() over(column1) from table1 t1 order by t1.c1


while the following is not:

Code:
select column1 as c1, rownumber() over(c1) from table1 t1 order by t1.c1


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.