Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ private LockingSupport buildLockingSupport() {
return new HANALockingSupport( supportsSkipLocked );
}


@Override
public DatabaseVersion determineDatabaseVersion(DialectResolutionInfo info) {
return HANALegacyServerConfiguration.staticDetermineDatabaseVersion( info );
Expand Down Expand Up @@ -652,7 +651,7 @@ public SQLExceptionConversionDelegate buildSQLExceptionConversionDelegate() {

@Override
public LockingSupport getLockingSupport() {
return HANALockingSupport.HANA_LOCKING_SUPPORT;
return lockingSupport;
}

@Override
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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" );

Expand Down Expand Up @@ -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" );

Expand Down Expand Up @@ -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" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand All @@ -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();

Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 -> {
Expand Down