HHH-12856 Reintroduce limitation for legacy OS400
This commit is contained in:
parent
b204c95e0c
commit
1038a0c968
|
@ -31,6 +31,17 @@ public class DB2400Dialect extends DB2Dialect {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLimitString(String sql, int offset, int limit) {
|
||||
if ( offset > 0 ) {
|
||||
throw new UnsupportedOperationException( "query result offset is not supported" );
|
||||
}
|
||||
if ( limit == 0 ) {
|
||||
return sql;
|
||||
}
|
||||
return sql + " fetch first " + limit + " rows only ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getForUpdateString() {
|
||||
return " for update with rs";
|
||||
|
|
|
@ -44,6 +44,18 @@ public class DB2400V7R3Dialect extends DB2400Dialect {
|
|||
"or sequence_schema = current_schema";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public String getLimitString(String sql, int offset, int limit) {
|
||||
if ( offset == 0 ) {
|
||||
return sql + " fetch first " + limit + " rows only";
|
||||
}
|
||||
//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 " + limit + " rows only ) as inner2_ ) as inner1_ where rownumber_ > "
|
||||
+ offset + " order by rownumber_";
|
||||
}
|
||||
|
||||
@Override
|
||||
public IdentityColumnSupport getIdentityColumnSupport() {
|
||||
return new DB2IdentityColumnSupport();
|
||||
|
|
Loading…
Reference in New Issue