package org.hibernate.dialect;
import org.hibernate.LockOptions;
public class PostgreSQL95Dialect extends PostgreSQL94Dialect {
@Override
public String getWriteLockString(int timeout) {
if ( timeout == LockOptions.SKIP_LOCKED ) {
return getForUpdateSkipLockedString();
}
else {
return super.getWriteLockString( timeout );
}
}
@Override
public String getWriteLockString(String aliases, int timeout) {
if ( timeout == LockOptions.SKIP_LOCKED ) {
return getForUpdateSkipLockedString( aliases );
}
else {
return super.getWriteLockString( aliases, timeout );
}
}
@Override
public String getReadLockString(int timeout) {
if ( timeout == LockOptions.SKIP_LOCKED ) {
return " for share skip locked";
}
else {
return super.getReadLockString( timeout );
}
}
@Override
public String getReadLockString(String aliases, int timeout) {
if ( timeout == LockOptions.SKIP_LOCKED ) {
return String.format( " for share of %s skip locked", aliases );
}
else {
return super.getReadLockString( aliases, timeout );
}
}
@Override
public String getForUpdateSkipLockedString() {
return " for update skip locked";
}
@Override
public String getForUpdateSkipLockedString(String aliases) {
return getForUpdateString() + " of " + aliases + " skip locked";
}
@Override
public boolean supportsSkipLocked() {
return true;
}
}