HHH-11642 - Fix index out of range failure for SQLServerDialect.

This commit is contained in:
Chris Cranford 2017-05-17 16:15:55 -04:00
parent fe0030c019
commit b1a322d1f3
1 changed files with 9 additions and 3 deletions

View File

@ -39,7 +39,13 @@ public class TopLimitHandler extends AbstractLimitHandler {
public boolean supportsLimitOffset() {
return supportsVariableLimit;
}
@Override
public boolean supportsVariableLimit() {
return supportsVariableLimit;
}
@Override
public boolean bindLimitParametersFirst() {
return bindLimitParametersFirst;
}
@ -56,14 +62,14 @@ public class TopLimitHandler extends AbstractLimitHandler {
StringBuilder sb = new StringBuilder( sql.length() + 8 )
.append( sql );
if ( supportsVariableLimit ) {
sb.insert( insertionPoint, " TOP ? " );
}
else {
sb.insert( insertionPoint, " TOP " + getMaxOrLimit( selection ) + " " );
}
return sb.toString();
}
}