| using Derby (v10.9.1.0 in our case) and hibernate org.hibernate.Query's setFirstResult(1000) and setMaxResults(500) results in an sql query like: select count(opcustomte0_) from OP_CUSTOMTEXTVALUE opcustomte0_ order by opcustomte0_.op_id offset 1000 rows fetch next 1500 rows only; which is not correct (should be .. next 500 rows ..)! The root cause is that useMaxForLimit() returns true (from within DB2Dialect) and therefor getMaxOrLimit (within AbstractLimitHandler:172) returns 'lastRow + firstRow' and not only 'lastRow' which would correctly return the value 500 in this example. |