diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/HANALegacyDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/HANALegacyDialect.java index a213bca84000..9bc6298e6c47 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/HANALegacyDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/HANALegacyDialect.java @@ -214,7 +214,6 @@ private LockingSupport buildLockingSupport() { return new HANALockingSupport( supportsSkipLocked ); } - @Override public DatabaseVersion determineDatabaseVersion(DialectResolutionInfo info) { return HANALegacyServerConfiguration.staticDetermineDatabaseVersion( info ); @@ -652,7 +651,7 @@ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() { @Override public LockingSupport getLockingSupport() { - return HANALockingSupport.HANA_LOCKING_SUPPORT; + return lockingSupport; } @Override @@ -885,16 +884,6 @@ public SequenceSupport getSequenceSupport() { return HANASequenceSupport.INSTANCE; } - @Override - public boolean supportsTableCheck() { - return true; - } - - @Override - public boolean supportsTupleDistinctCounts() { - return true; - } - @Override public boolean dropConstraints() { return false; diff --git a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java index 57d5231c4e04..b3d21c1ca42e 100644 --- a/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java +++ b/hibernate-community-dialects/src/main/java/org/hibernate/community/dialect/InformixDialect.java @@ -572,9 +572,18 @@ public LimitHandler getLimitHandler() { @Override public LockingSupport getLockingSupport() { + // TODO: need a custom impl, because: + // 1. Informix does not support 'skip locked' + // 2. Informix does not allow 'for update' with joins return LockingSupportSimple.STANDARD_SUPPORT; } + // TODO: remove once we have a custom LockingSupport impl + @Override @Deprecated(forRemoval = true) + public boolean supportsSkipLocked() { + return false; + } + @Override public boolean supportsIfExistsBeforeTableName() { return getVersion().isSameOrAfter( 11, 70 ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bulkid/AbstractMutationStrategyGeneratedIdentityTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bulkid/AbstractMutationStrategyGeneratedIdentityTest.java index 4884e426da10..dd7236fb806b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bulkid/AbstractMutationStrategyGeneratedIdentityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bulkid/AbstractMutationStrategyGeneratedIdentityTest.java @@ -12,6 +12,7 @@ import jakarta.persistence.InheritanceType; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Configuration; +import org.hibernate.community.dialect.InformixDialect; import org.hibernate.dialect.AbstractTransactSQLDialect; import org.hibernate.dialect.MySQLDialect; import org.hibernate.dialect.OracleDialect; @@ -71,6 +72,7 @@ public void setUp() { @Test @SkipForDialect(dialectClass = MySQLDialect.class, matchSubTypes = true, reason = "MySQL ignores a provided value for an auto_increment column if it's lower than the current sequence value") @SkipForDialect(dialectClass = AbstractTransactSQLDialect.class, matchSubTypes = true, reason = "T-SQL complains IDENTITY_INSERT is off when a value for an identity column is provided") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix counts from 1 like a normal person") public void testInsertStatic() { doInHibernate( this::sessionFactory, session -> { session.createQuery( "insert into Engineer(id, name, employed, fellow) values (0, :name, :employed, false)" ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/SingleTableConstraintsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/SingleTableConstraintsTest.java index aa97fe5acb10..fc0098ae1d1d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/SingleTableConstraintsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/inheritance/SingleTableConstraintsTest.java @@ -12,8 +12,10 @@ import jakarta.persistence.ManyToOne; import jakarta.validation.constraints.NotNull; import org.hibernate.exception.ConstraintViolationException; +import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.hibernate.testing.orm.junit.Jpa; +import org.hibernate.testing.orm.junit.RequiresDialectFeature; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -26,6 +28,7 @@ SingleTableConstraintsTest.Journal.class, SingleTableConstraintsTest.Paper.class, SingleTableConstraintsTest.Monograph.class}) +@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTableCheck.class) class SingleTableConstraintsTest { @Test void test(EntityManagerFactoryScope scope) { scope.inTransaction( em -> { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockExceptionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockExceptionTests.java index 87628a73d76d..ba6ed85fbcb0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockExceptionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/LockExceptionTests.java @@ -10,6 +10,7 @@ import org.hibernate.Timeouts; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.AvailableSettings; +import org.hibernate.community.dialect.InformixDialect; import org.hibernate.dialect.CockroachDialect; import org.hibernate.dialect.SQLServerDialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; @@ -53,6 +54,7 @@ protected void tearDown() { @Test @JiraKey( value = "HHH-8786" ) @SkipForDialect(dialectClass = CockroachDialect.class, reason = "for update clause does not imply locking. See https://github.com/cockroachdb/cockroach/issues/88995") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "no failure") public void testLockTimeoutFind() { final Item item = new Item( "find" ); @@ -94,6 +96,7 @@ public void testLockTimeoutFind() { @Test @SkipForDialect(dialectClass = CockroachDialect.class, reason = "Cockroach uses SERIALIZABLE by default and seems to fail reading a row that is exclusively locked by a different TX") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "Cursor must be on simple SELECT for FOR UPDATE") public void testLockTimeoutRefresh() { final Item item = new Item( "refresh" ); @@ -136,6 +139,7 @@ public void testLockTimeoutRefresh() { @Test @SkipForDialect(dialectClass = CockroachDialect.class, reason = "Cockroach uses SERIALIZABLE by default and seems to fail reading a row that is exclusively locked by a different TX") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "no failure") public void testLockTimeoutLock() { final Item item = new Item( "lock" ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/LockedRowsTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/LockedRowsTests.java index 7cd70f8e82b0..beb6d3b559bf 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/LockedRowsTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/LockedRowsTests.java @@ -7,6 +7,7 @@ import jakarta.persistence.LockModeType; import jakarta.persistence.Timeout; import org.hibernate.PessimisticLockException; +import org.hibernate.community.dialect.InformixDialect; import org.hibernate.dialect.MariaDBDialect; import org.hibernate.dialect.lock.PessimisticEntityLockException; import org.hibernate.jpa.SpecHints; @@ -66,6 +67,7 @@ void dropTestData(SessionFactoryScope factoryScope) { @Test @RequiresDialectFeature(feature = DialectFeatureChecks.SupportNoWait.class) + @SkipForDialect(dialectClass = InformixDialect.class, reason = "no failure") void testFindNoWait(SessionFactoryScope factoryScope) { factoryScope.inTransaction( (session) -> { assert session.getDialect().supportsNoWait(); @@ -84,6 +86,7 @@ void testFindNoWait(SessionFactoryScope factoryScope) { @Test @RequiresDialectFeature(feature = DialectFeatureChecks.SupportNoWait.class) + @SkipForDialect(dialectClass = InformixDialect.class, reason = "no failure") void testLockNoWait(SessionFactoryScope factoryScope) { factoryScope.inTransaction( (session) -> { session.find(Book.class,1, PESSIMISTIC_WRITE); @@ -128,6 +131,7 @@ void testQuerySkipLocked(SessionFactoryScope factoryScope) { dialectClass = MariaDBDialect.class, reason = "Cannot figure this out - it passes when run by itself, but fails when run as part of the complete suite." ) + @SkipForDialect(dialectClass = InformixDialect.class, reason = "no failure") void testFindSkipLocked(SessionFactoryScope factoryScope) { factoryScope.inTransaction( (session) -> { session.find(Book.class,1, PESSIMISTIC_WRITE); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeAndSecondaryTableTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeAndSecondaryTableTests.java index fe983fe804b5..586047f889cf 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeAndSecondaryTableTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeAndSecondaryTableTests.java @@ -5,12 +5,14 @@ package org.hibernate.orm.test.locking.options; import jakarta.persistence.LockModeType; +import org.hibernate.community.dialect.InformixDialect; import org.hibernate.testing.jdbc.SQLStatementInspector; import org.hibernate.testing.orm.junit.DialectFeatureChecks; import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.RequiresDialectFeature; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.hibernate.testing.orm.junit.SkipForDialect; import org.hibernate.testing.orm.transaction.TransactionUtil; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -40,6 +42,7 @@ void dropTestData(SessionFactoryScope factoryScope) { @Test @RequiresDialectFeature(feature=DialectFeatureChecks.SupportsLockingJoins.class, comment = "Come back and rework this to account for follow-on testing") + @SkipForDialect( dialectClass = InformixDialect.class, reason = "Cursor must be on simple SELECT for FOR UPDATE") void simpleTest(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); factoryScope.inTransaction( (session) -> { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeTests.java index 44bebf17a10e..5dad9614859e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/options/ScopeTests.java @@ -7,6 +7,7 @@ import org.hibernate.EnabledFetchProfile; import org.hibernate.Hibernate; import org.hibernate.Locking; +import org.hibernate.community.dialect.InformixDialect; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; import org.hibernate.dialect.HSQLDialect; @@ -60,6 +61,7 @@ void dropTestData(SessionFactoryScope factoryScope) { // todo : generally, we do not lock collection tables - HHH-19513 plus maybe general problem with many-to-many tables @Test + @SkipForDialect(dialectClass = InformixDialect.class, reason = "update does not block") void testFind(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -75,6 +77,7 @@ void testFind(SessionFactoryScope factoryScope) { } @Test + @SkipForDialect(dialectClass = InformixDialect.class, reason = "update does not block") void testFindWithExtended(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -111,6 +114,7 @@ void testFindWithExtendedJpaExpectation(SessionFactoryScope factoryScope) { @Test @SkipForDialect(dialectClass = HSQLDialect.class, reason = "See https://sourceforge.net/p/hsqldb/bugs/1734/") @SkipForDialect(dialectClass = H2Dialect.class, reason = "H2 seems to not extend locks across joins") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "Cursor must be on simple SELECT for FOR UPDATE") void testFindWithExtendedAndFetch(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -148,6 +152,7 @@ void testFindWithExtendedAndFetch(SessionFactoryScope factoryScope) { } @Test + @SkipForDialect(dialectClass = InformixDialect.class, reason = "update does not block") void testLock(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -167,6 +172,7 @@ void testLock(SessionFactoryScope factoryScope) { } @Test + @SkipForDialect(dialectClass = InformixDialect.class, reason = "update does not block") void testLockWithExtended(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -185,6 +191,7 @@ void testLockWithExtended(SessionFactoryScope factoryScope) { } @Test + @SkipForDialect(dialectClass = InformixDialect.class, reason = "update does not block") void testRefresh(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -202,6 +209,7 @@ void testRefresh(SessionFactoryScope factoryScope) { } @Test + @SkipForDialect(dialectClass = InformixDialect.class, reason = "update does not block") void testRefreshWithExtended(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -221,6 +229,7 @@ void testRefreshWithExtended(SessionFactoryScope factoryScope) { @Test @SkipForDialect(dialectClass = HSQLDialect.class, reason = "See https://sourceforge.net/p/hsqldb/bugs/1734/") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "Cursor must be on simple SELECT for FOR UPDATE") void testEagerFind(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -253,6 +262,7 @@ private boolean willAggressivelyLockJoinedTables(Dialect dialect) { @Test @SkipForDialect(dialectClass = HSQLDialect.class, reason = "See https://sourceforge.net/p/hsqldb/bugs/1734/") @SkipForDialect(dialectClass = H2Dialect.class, reason = "H2 seems to not extend locks across joins") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "Cursor must be on simple SELECT for FOR UPDATE") void testEagerFindWithExtended(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); @@ -288,6 +298,7 @@ void testEagerFindWithExtended(SessionFactoryScope factoryScope) { @Test @SkipForDialect(dialectClass = HSQLDialect.class, reason = "See https://sourceforge.net/p/hsqldb/bugs/1734/") @SkipForDialect(dialectClass = H2Dialect.class, reason = "H2 seems to not extend locks across joins") + @SkipForDialect(dialectClass = InformixDialect.class, reason = "Cursor must be on simple SELECT for FOR UPDATE") void testEagerFindWithFetchScope(SessionFactoryScope factoryScope) { final SQLStatementInspector sqlCollector = factoryScope.getCollectingStatementInspector(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated/GeneratedByDbOnForcedIncrementTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated/GeneratedByDbOnForcedIncrementTest.java index b193313ce8e4..221d96831965 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated/GeneratedByDbOnForcedIncrementTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated/GeneratedByDbOnForcedIncrementTest.java @@ -9,8 +9,10 @@ import jakarta.persistence.Id; import jakarta.persistence.Version; import org.hibernate.annotations.UpdateTimestamp; +import org.hibernate.community.dialect.InformixDialect; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.hibernate.testing.orm.junit.Jpa; +import org.hibernate.testing.orm.junit.SkipForDialect; import org.junit.jupiter.api.Test; import java.time.LocalDateTime; @@ -20,6 +22,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @Jpa(annotatedClasses = GeneratedByDbOnForcedIncrementTest.WithUpdateTimestamp.class) +@SkipForDialect(dialectClass = InformixDialect.class, + reason = "JDBC driver returns timestamp with seconds precision") class GeneratedByDbOnForcedIncrementTest { @Test void test(EntityManagerFactoryScope scope) throws InterruptedException { var persisted = scope.fromTransaction( em -> {