diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CockroachLegacyDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CockroachLegacyDialect.java index 80dc0affc598..25ff2c9fcea8 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CockroachLegacyDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/CockroachLegacyDialect.java @@ -75,7 +75,6 @@ import org.hibernate.type.descriptor.jdbc.BlobJdbcType; import org.hibernate.type.descriptor.jdbc.ClobJdbcType; import org.hibernate.type.descriptor.jdbc.JdbcType; -import org.hibernate.type.descriptor.jdbc.NClobJdbcType; import org.hibernate.type.descriptor.jdbc.ObjectNullAsBinaryTypeJdbcType; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry; import org.hibernate.type.descriptor.sql.internal.DdlTypeImpl; @@ -421,7 +420,7 @@ protected void contributeCockroachTypes(TypeContributions typeContributions, Ser // Force Blob binding to byte[] for CockroachDB jdbcTypeRegistry.addDescriptor( Types.BLOB, BlobJdbcType.MATERIALIZED ); jdbcTypeRegistry.addDescriptor( Types.CLOB, ClobJdbcType.MATERIALIZED ); - jdbcTypeRegistry.addDescriptor( Types.NCLOB, NClobJdbcType.MATERIALIZED ); + jdbcTypeRegistry.addDescriptor( Types.NCLOB, ClobJdbcType.MATERIALIZED ); // The next two contributions are the same as for Postgresql typeContributions.contributeJdbcType( ObjectNullAsBinaryTypeJdbcType.INSTANCE ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java index 440cc014f3c6..5c11e834894d 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/CockroachDialect.java @@ -67,7 +67,6 @@ import org.hibernate.type.descriptor.jdbc.BlobJdbcType; import org.hibernate.type.descriptor.jdbc.ClobJdbcType; import org.hibernate.type.descriptor.jdbc.JdbcType; -import org.hibernate.type.descriptor.jdbc.NClobJdbcType; import org.hibernate.type.descriptor.jdbc.ObjectNullAsBinaryTypeJdbcType; import org.hibernate.type.descriptor.jdbc.UUIDJdbcType; import org.hibernate.type.descriptor.jdbc.spi.JdbcTypeRegistry; @@ -384,7 +383,7 @@ protected void contributeCockroachTypes(TypeContributions typeContributions, Ser // Force Blob binding to byte[] for CockroachDB jdbcTypeRegistry.addDescriptor( Types.BLOB, BlobJdbcType.MATERIALIZED ); jdbcTypeRegistry.addDescriptor( Types.CLOB, ClobJdbcType.MATERIALIZED ); - jdbcTypeRegistry.addDescriptor( Types.NCLOB, NClobJdbcType.MATERIALIZED ); + jdbcTypeRegistry.addDescriptor( Types.NCLOB, ClobJdbcType.MATERIALIZED ); // The next two contributions are the same as for Postgresql typeContributions.contributeJdbcType( ObjectNullAsBinaryTypeJdbcType.INSTANCE ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/internal/CockroachLockingSupport.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/internal/CockroachLockingSupport.java index 6f41f9f47bab..4db473322ad2 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/internal/CockroachLockingSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/internal/CockroachLockingSupport.java @@ -15,7 +15,6 @@ import java.sql.Connection; -import static org.hibernate.Timeouts.NO_WAIT; import static org.hibernate.Timeouts.NO_WAIT_MILLI; import static org.hibernate.Timeouts.SKIP_LOCKED_MILLI; import static org.hibernate.Timeouts.WAIT_FOREVER; @@ -82,11 +81,9 @@ public Timeout getLockTimeout(Connection connection, SessionFactoryImplementor f return Helper.getLockTimeout( "show lock_timeout", (resultSet) -> { - // see https://dev.mysql.com/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_lock_wait_timeout final int millis = resultSet.getInt( 1 ); return switch ( millis ) { - case 0 -> NO_WAIT; - case 100000000 -> WAIT_FOREVER; + case 0 -> WAIT_FOREVER; default -> Timeout.milliseconds( millis ); }; }, @@ -103,15 +100,14 @@ public void setLockTimeout( Helper.setLockTimeout( timeout, (t) -> { - // see https://dev.mysql.com/doc/refman/8.4/en/innodb-parameters.html#sysvar_innodb_lock_wait_timeout final int milliseconds = timeout.milliseconds(); if ( milliseconds == SKIP_LOCKED_MILLI ) { throw new HibernateException( "Connection lock-timeout does not accept skip-locked" ); } - if ( milliseconds == WAIT_FOREVER_MILLI ) { - return 100000000; + if ( milliseconds == NO_WAIT_MILLI ) { + throw new HibernateException( "Connection lock-timeout does not accept no-wait" ); } - return milliseconds; + return milliseconds == WAIT_FOREVER_MILLI ? 0 : milliseconds; }, "set lock_timeout = %s", connection, diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java index 7bb583f3801f..9476ef9707b3 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java @@ -453,7 +453,6 @@ public boolean apply(Dialect dialect) { public static class SupportsCteInsertStrategy implements DialectFeatureCheck { public boolean apply(Dialect dialect) { return dialect instanceof PostgreSQLDialect - || dialect instanceof CockroachDialect || dialect instanceof DB2Dialect || dialect instanceof GaussDBDialect; }