We're updating the issue view to help you get more done. 

SQLServer2005Dialect (and above) does not support read past locking

Description

When added support for read past locking, it only updated the base SQLServerDialect.appendLockHint method.

That method was overridden in SQLServer2005Dialect but support for read past locking was not added to this method.

A simple fix is to simply add support for LockMode.UPGRADE_SKIPLOCKED to the switch statement in SQLServer2005Dialect.

An alternative fix is to replace SQLServer2005Dialect.appendLockMode with the following which avoids completely overriding the parent method (but requires a String.replace call):

1 2 3 4 5 6 7 8 9 10 11 12 @Override public String appendLockHint(LockOptions lockOptions, String tableName) { String lockHint = super.appendLockHint(lockOptions, tableName); // NOTE : since SQLServer2005 the nowait hint is supported final boolean isNoWait = lockOptions.getTimeOut() == LockOptions.NO_WAIT; if ( isNoWait || lockOptions.getLockMode() == LockMode.UPGRADE_NOWAIT ) { lockHint = lockHint.replace("rowlock", "rowlock, nowait"); } return lockHint; }

Environment

None

Status

Assignee

Andrea Boriero

Reporter

Caspian Borison

Labels

Suitable for new contributors

Yes, likely

Fix versions

Affects versions

4.3.8
5.0.2

Priority

Major