| [Andrea Boriero / [Holly Hamlyn I just ran my test (which I will attach) against both SQL Server 2005 and SQL Server 2008 (which both use the same SQLServer2005Dialect) and SQL Server 2012 ( which uses the new SQLServer2012Dialect and Offset/Fetch LimitHandler) and I couldn't reproduce the problem. Using the older versions of SQL Server (2005/2008), the only time the AbstractLimitHandler's bindLimitParametersAtEndOfQuery is invoked is when the query uses a non-TOP based query, therefore you would have not only provided a setMaxResults() call, but also a setFirstResult() call too to even get to that code. Using the newer versions of SQL Server (2012/2016), the only time the AbstractLimitHandler's bindLimitParametersAtEndOfQuery is invoked is when the new limit handler doesn't apply an offset/fetch clause and limit handler doesn't specify a setFirstResult(). This is only possible if you do not provide an ORDER BY clause of which your test case says you are. In fact, I tested both with and without an ORDER BY clause to be sure (see #buildDynamicQueryString second parameter being set to false). Under none of these cases could I reproduce the failure. |