We have a simple query that was working with Hibernate 4.1.9 and is now not working after updating to Hibernate 5 (CR4). It's basically a simple HQL query on a single table:
According to the sql logging this translates into something like:
And following exception is caught:
The only way I could get rid of this problem was to extend the SQLServerDialect and instead of returning TopLimitHandler in getLimitHandler to deliver SQLServer2005LimitHandler. When using TopLimitHandler this exception occurs, when using SQLServer2005LimitHandler the query works fine.
So I guess this may be a problem in the LimitHandler implementation.
MS SQL Server 2005 (Windows)