So in 4.x what happens is that the offset is simply not applied to the SQL. So all rows up to your limit (via TOP) are returned and we then advance the ResultSet to your requested offset. Extremely poor performance. At the moment in 5.x for SQLServerDialect what happens instead is that we simply throw an error. I honestly do not remember if this was a conscious decision or an accident. But I do have to say that I am leery of changing this on 5.x to work in the way 4.x did due to the performance aspect. That said you could certainly supply a custom Dialect for the purpose of returning a "better" LimitHandler - specifically one that defines LimitHandler#supportsLimitOffset as false for SQL Server 2000. That should give you the same behavior. |