mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 00:24:57 +00:00
HHH-10489 : DB2400Dialect could use the same LimitHandler as DB2Dialect
HHH-11150 : DB2 on AS400 (DB2400 Dialect) fails to paginate. Leveraged code from the DB2 Dialect and placed in DB2400Dialect. This was then tested on an AS400 successfully.
This commit is contained in:
parent
0c8261b0ae
commit
5f50e1e919
@ -24,8 +24,11 @@ public class DB2400Dialect extends DB2Dialect {
|
||||
private static final AbstractLimitHandler LIMIT_HANDLER = new AbstractLimitHandler() {
|
||||
@Override
|
||||
public String processSql(String sql, RowSelection selection) {
|
||||
if (LimitHelper.hasFirstRow( selection )) {
|
||||
throw new UnsupportedOperationException( "query result offset is not supported" );
|
||||
if ( LimitHelper.hasFirstRow( selection ) ) {
|
||||
//nest the main query in an outer select
|
||||
return "select * from ( select inner2_.*, rownumber() over(order by order of inner2_) as rownumber_ from ( "
|
||||
+ sql + " fetch first " + getMaxOrLimit( selection ) + " rows only ) as inner2_ ) as inner1_ where rownumber_ > "
|
||||
+ selection.getFirstRow() + " order by rownumber_";
|
||||
}
|
||||
return sql + " fetch first " + getMaxOrLimit( selection ) + " rows only";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user