Tuesday, March 14, 2017

Hibernate setMaxResults throws SQLServerException index 1 out of range

So, I was in the middle of migrating Hibernate from 3.2.6 to 5.2.8 and everything went smoothly until the HQL queries that used to work started to fail for a reason I did not know. The exception was
 SQLServerException: index 1 out of range  
The issue turned out to be change in SQLServer dialect from
 org.hibernate.dialect.SQLServerDialect
to the new
 org.hibernate.dialect.SQLServer2008Dialect
This resolved the issue. Hope this helps you too. Please leave a comment about your experience. Thanks.

No comments :