SQLServerException: The index 2 is out of range when executiong Spring Data findAll(Pageable)
Description
Attachments
Activity

Chris Cranford May 17, 2017 at 7:49 PM
, explicitly specifying the SQLSeverDialect
rather than using the dialect resolver strategy does indeed throw the exception. I've tracked it down to a code change in TopLimitHandler
that I'll address now.

Chris Cranford May 15, 2017 at 4:42 PM(edited)
Was the SQLServerDialect
something being driven by the configuration or was that something that Hibernate was defaulting? We added a fix in to adjust the dialect resolution for SQLServer which is why I ask how the legacy dialect was being influenced because that was fixed in 5.2.5 (and your logs show 5.2.10).
I'll change my test environment to force the legacy dialect to reproduce. Ideally we'd prefer using the legacy dialects on newer database platforms to not be broken, e.g. they should be backward compatible but with just less features or less than optimal choices for the environment where possible but given certain conditions, that may not always work out as we intend.

Brett Wooldridge May 15, 2017 at 3:59 PM(edited)
Just ran the oltpbenchmark JPAB test again on my Hibernate 5 branch, here is the output (using the mssql-jdbc-6.1.6.jre8-preview.jar driver):
Is the issue that the dialect is SQLServerDialect and not SQLServer2012Dialect?
Answering my own question: Yes. Changing the benchmark code to use SQLServer2012Dialect removes the issue.

Brett Wooldridge May 15, 2017 at 3:45 PM(edited)
Chris Cranford, I'll make another run soon to see if I can reproduce. I was running the v6.1.6 driver. And I was using my fork/branch of the oltpbenchmark wherein I upgraded the Hibernate from v3 to v4.3.11.
EDIT: Sorry, mis-typed. Hibernate v4.3.11 works. It is my Hibernate 5 branch that showed the issue (again with the v6.1.6 driver).

Chris Cranford May 15, 2017 at 1:12 PM
, I just used the following:
I didn't run into any issues against a Microsoft SQL Server 2016 environment using SQLServer2012Dialect with the 6.1.0.0 driver. Thoughts?
When the Spring Data findAll(Pageable) method of an entity is called, the query states it cannot be executed by Hibernate. It uses query.setFirstResult(1) and query.setMaxResults(20) to limit the result set:
The stack trace shown is: