HHH-16541 Don't report supportsSkipLocked() for Sybase

This commit is contained in:
Christian Beikov 2023-05-17 16:22:21 +02:00
parent 8fcd3a1f54
commit bee160e9f2
4 changed files with 7 additions and 11 deletions

View File

@ -592,13 +592,14 @@ public class SybaseASELegacyDialect extends SybaseLegacyDialect {
@Override
public boolean supportsSkipLocked() {
return true;
// It does support skipping locked rows only for READ locking
return false;
}
@Override
public String appendLockHint(LockOptions mode, String tableName) {
final String lockHint = super.appendLockHint( mode, tableName );
return mode.getLockMode() == LockMode.UPGRADE_SKIPLOCKED || mode.getTimeOut() == LockOptions.SKIP_LOCKED
return !mode.getLockMode().greaterThan( LockMode.READ ) && mode.getTimeOut() == LockOptions.SKIP_LOCKED
? lockHint + " readpast"
: lockHint;
}

View File

@ -594,13 +594,14 @@ public class SybaseASEDialect extends SybaseDialect {
@Override
public boolean supportsSkipLocked() {
return true;
// It does support skipping locked rows only for READ locking
return false;
}
@Override
public String appendLockHint(LockOptions mode, String tableName) {
final String lockHint = super.appendLockHint( mode, tableName );
return mode.getLockMode() == LockMode.UPGRADE_SKIPLOCKED || mode.getTimeOut() == LockOptions.SKIP_LOCKED
return !mode.getLockMode().greaterThan( LockMode.READ ) && mode.getTimeOut() == LockOptions.SKIP_LOCKED
? lockHint + " readpast"
: lockHint;
}

View File

@ -282,7 +282,7 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@RequiresDialectFeature( value = DialectChecks.SupportSkipLocked.class )
@RequiresDialectFeature( value = DialectChecks.SupportsSkipLocked.class )
@SkipForDialect(value = CockroachDialect.class, comment = "for update clause does not imply locking. See https://github.com/cockroachdb/cockroach/issues/88995")
public void testUpdateWithPessimisticReadLockSkipLocked() {
Lock lock = new Lock();

View File

@ -198,12 +198,6 @@ abstract public class DialectChecks {
}
}
public static class SupportSkipLocked implements DialectCheck {
public boolean isMatch(Dialect dialect) {
return dialect.supportsSkipLocked();
}
}
public static class SupportNoWait implements DialectCheck {
public boolean isMatch(Dialect dialect) {
return dialect.supportsNoWait();