We have setup a test case showcasing the problem here: https://github.com/ElderByte-/hibernate-setFirstResult-mssql Short version: The following code works with Hibernate 4, SQLServerDialect, connected to a MSSQL 2000 Server. The exact same code fails however, if Hibernate 5 is in use.
public List<FooBar> getAllByName(Session session){
Query query = session.createQuery("from FooBar");
query.setFirstResult(1);
query.setMaxResults(5);
return (List<FooBar>)query.list();
}
The code in the repository is as simple as possible to reproduce the issue. I hope this helps in tracking the issue down. |