When
HHH-6736
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 swithc 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):
monospaced @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; } monospaced
|