diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBDialect.java index 9836b5f00daf..eb9f7f6cf90a 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/GaussDBDialect.java @@ -16,6 +16,7 @@ import org.hibernate.boot.model.FunctionContributions; import org.hibernate.boot.model.TypeContributions; import org.hibernate.community.dialect.identity.GaussDBIdentityColumnSupport; +import org.hibernate.community.dialect.lock.internal.GaussDBLockingSupport; import org.hibernate.community.dialect.sequence.GaussDBSequenceSupport; import org.hibernate.dialect.BooleanDecoder; import org.hibernate.dialect.Dialect; @@ -29,6 +30,7 @@ import org.hibernate.dialect.TimeZoneSupport; import org.hibernate.dialect.aggregate.AggregateSupport; import org.hibernate.dialect.identity.IdentityColumnSupport; +import org.hibernate.dialect.lock.spi.LockingSupport; import org.hibernate.dialect.pagination.LimitHandler; import org.hibernate.dialect.pagination.LimitLimitHandler; import org.hibernate.dialect.sequence.SequenceSupport; @@ -148,6 +150,7 @@ * GaussDB documentation. * * @author liubao + * @author chen zhida * * Notes: Original code of this class is based on PostgreSQLDialect. */ @@ -1121,6 +1124,11 @@ public String getReadLockString(String aliases, int timeout) { return withTimeout(" for share of " + aliases, timeout ); } + @Override + public LockingSupport getLockingSupport() { + return GaussDBLockingSupport.LOCKING_SUPPORT; + } + @Override public String getForUpdateNowaitString() { return supportsNoWait() diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/lock/internal/GaussDBLockingSupport.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/lock/internal/GaussDBLockingSupport.java new file mode 100644 index 000000000000..1fd9a3fbb3c2 --- /dev/null +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/lock/internal/GaussDBLockingSupport.java @@ -0,0 +1,47 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * Copyright Red Hat Inc. and Hibernate Authors + */ +package org.hibernate.community.dialect.lock.internal; + +import org.hibernate.dialect.RowLockStrategy; +import org.hibernate.dialect.lock.spi.ConnectionLockTimeoutStrategy; +import org.hibernate.dialect.lock.spi.LockingSupport; +import org.hibernate.dialect.lock.spi.OuterJoinLockingType; + + + +/** + * @author chen zhida + * + * Notes: Original code of this class is based on PostgreSQLLockingSupport. + */ +public class GaussDBLockingSupport implements LockingSupport, LockingSupport.Metadata, ConnectionLockTimeoutStrategy { + public static final LockingSupport LOCKING_SUPPORT = new GaussDBLockingSupport(); + + + @Override + public Metadata getMetadata() { + return this; + } + + @Override + public RowLockStrategy getWriteRowLockStrategy() { + return RowLockStrategy.TABLE; + } + + @Override + public OuterJoinLockingType getOuterJoinLockingType() { + return OuterJoinLockingType.UNSUPPORTED; + } + + @Override + public ConnectionLockTimeoutStrategy getConnectionLockTimeoutStrategy() { + return this; + } + + @Override + public Level getSupportedLevel() { + return Level.NONE; + } +}