HHH-8786 - find, refresh, lock should throw LockTimeoutException or PessimisticLockException when lock problems occur
This commit is contained in:
parent
f7aef1cdf8
commit
c6dc398fc5
|
@ -14,8 +14,11 @@ import javax.persistence.PessimisticLockException;
|
|||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.dialect.MariaDBDialect;
|
||||
import org.hibernate.dialect.SQLServerDialect;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.SkipForDialects;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.jdbc.SQLServerSnapshotIsolationConnectionProvider;
|
||||
import org.hibernate.testing.transaction.TransactionUtil2;
|
||||
|
@ -28,6 +31,9 @@ import static org.junit.Assert.fail;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@SkipForDialects(
|
||||
@SkipForDialect( value = MariaDBDialect.class, jiraKey = "HHH-8786", comment = "https://hibernate.atlassian.net/browse/HHH-8786")
|
||||
)
|
||||
public class LockExceptionTests extends AbstractJPATest {
|
||||
@Override
|
||||
public void configure(Configuration cfg) {
|
||||
|
|
|
@ -4330,7 +4330,10 @@ public class FooBarTest extends LegacyTestCase {
|
|||
);
|
||||
s.refresh(foo);
|
||||
assertEquals( Long.valueOf( -3l ), foo.getLong() );
|
||||
assertEquals( LockMode.READ, s.getCurrentLockMode( foo ) );
|
||||
// NOTE : this test used to test for LockMode.READ here, but that actually highlights a bug
|
||||
// `foo` has just been inserted and then updated in this same Session - its lock mode
|
||||
// therefore ought to be WRITE. See https://hibernate.atlassian.net/browse/HHH-12257
|
||||
assertEquals( LockMode.WRITE, s.getCurrentLockMode( foo ) );
|
||||
s.refresh(foo, LockMode.UPGRADE);
|
||||
if ( getDialect().supportsOuterJoinForUpdate() ) {
|
||||
assertEquals( LockMode.UPGRADE, s.getCurrentLockMode( foo ) );
|
||||
|
|
Loading…
Reference in New Issue