Handle timeout exception for older H2 versions and igonre a test for Cockroach
This commit is contained in:
parent
8cf4c4e95f
commit
5d63218deb
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
import java.util.TimeZone;
|
||||
|
||||
import org.hibernate.PessimisticLockException;
|
||||
import org.hibernate.QueryTimeoutException;
|
||||
import org.hibernate.boot.model.FunctionContributions;
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.DatabaseVersion;
|
||||
|
@ -759,6 +760,8 @@ public class H2LegacyDialect extends Dialect {
|
|||
// NULL not allowed for column [90006-145]
|
||||
final String constraintName = getViolatedConstraintNameExtractor().extractConstraintName(sqlException);
|
||||
return new ConstraintViolationException(message, sqlException, sql, constraintName);
|
||||
case 57014:
|
||||
return new QueryTimeoutException( message, sqlException, sql );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -17,6 +17,7 @@ import java.util.List;
|
|||
import java.util.TimeZone;
|
||||
|
||||
import org.hibernate.PessimisticLockException;
|
||||
import org.hibernate.QueryTimeoutException;
|
||||
import org.hibernate.boot.model.FunctionContributions;
|
||||
import org.hibernate.boot.model.TypeContributions;
|
||||
import org.hibernate.dialect.function.CommonFunctionFactory;
|
||||
|
@ -753,6 +754,8 @@ public class H2Dialect extends Dialect {
|
|||
// NULL not allowed for column [90006-145]
|
||||
final String constraintName = getViolatedConstraintNameExtractor().extractConstraintName(sqlException);
|
||||
return new ConstraintViolationException(message, sqlException, sql, constraintName);
|
||||
case 57014:
|
||||
return new QueryTimeoutException( message, sqlException, sql );
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.orm.test.locking.jpa;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.dialect.CockroachDialect;
|
||||
import org.hibernate.dialect.HSQLDialect;
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
|
||||
|
@ -35,6 +36,7 @@ import static org.hibernate.jpa.SpecHints.HINT_SPEC_QUERY_TIMEOUT;
|
|||
@DomainModel(annotatedClasses = { Employee.class, Department.class })
|
||||
@SessionFactory(useCollectingStatementInspector = true)
|
||||
@SkipForDialect(dialectClass = HSQLDialect.class, reason = "Seems HSQLDB doesn't cancel the query if it waits for a lock?!")
|
||||
@SkipForDialect(dialectClass = CockroachDialect.class, reason = "Cockroach allows the concurrent access but cancels one or both transactions at the end")
|
||||
public class FollowOnLockingTest {
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue