HHH-13577 LockTest.testContendedPessimisticLock and StatementIsClosedAfterALockExceptionTest.testStatementIsClosed tests fail on Sybase
HHH-13577 : Re-enable LockTest for SybaseASE15Dialect
(cherry picked from commit 210aff098c
)
This commit is contained in:
parent
e60defd402
commit
60cb3762ba
|
@ -559,7 +559,6 @@ public class LockTest extends BaseEntityManagerFunctionalTestCase {
|
|||
@SkipForDialect(HSQLDialect.class)
|
||||
// ASE15.5 will generate select...holdlock and fail at this test, but ASE15.7 passes it. Skip it for ASE15.5
|
||||
// only.
|
||||
@SkipForDialect(value = { SybaseASE15Dialect.class }, strictMatching = true, jiraKey = "HHH-6820")
|
||||
@SkipForDialect(value = { SQLServerDialect.class })
|
||||
public void testContendedPessimisticLock() throws Exception {
|
||||
final CountDownLatch latch = new CountDownLatch( 1 );
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.hibernate.dialect.H2Dialect;
|
|||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.dialect.SQLServerDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
@ -568,6 +569,12 @@ public class TransactionUtil {
|
|||
st.execute(String.format( "SET TRANSACTION LOCK WAIT TIMEOUT %d", millis ));
|
||||
}
|
||||
}
|
||||
else if( Dialect.getDialect() instanceof SybaseASE15Dialect) {
|
||||
try (Statement st = connection.createStatement()) {
|
||||
//Prepared Statements fail for SET commands
|
||||
st.execute(String.format( "SET LOCK WAIT %d", millis/1000 ));
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
connection.setNetworkTimeout( Executors.newSingleThreadExecutor(), (int) millis );
|
||||
|
|
|
@ -82,7 +82,9 @@ public class ExceptionUtil {
|
|||
rootCause != null && (
|
||||
rootCause.getMessage().contains( "timeout" ) ||
|
||||
rootCause.getMessage().contains( "timed out" ) ||
|
||||
rootCause.getMessage().contains( "lock(s) could not be acquired" )
|
||||
rootCause.getMessage().contains( "lock(s) could not be acquired" ) ||
|
||||
rootCause.getMessage().contains( "Could not acquire a lock" )
|
||||
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue