HHH-18023 fix wrong test assertions

OPTIMISTIC means the version gets checked at end of tx,
this lock mode is never acquired implicitly

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-04-28 16:37:14 +02:00
parent 1657702015
commit 1e0e0ac02b
1 changed files with 6 additions and 6 deletions

View File

@ -79,7 +79,7 @@ public class BatchAndLockTest {
scope.inTransaction(
session -> {
TestEntity testEntity = session.find( TestEntity.class, 1 );
assertEntityLockMode( testEntity, LockModeType.OPTIMISTIC, session );
assertEntityLockMode( testEntity, LockModeType.NONE, session );
}
);
assertNoLokIsApplied( scope );
@ -93,11 +93,11 @@ public class BatchAndLockTest {
assertFalse( Hibernate.isInitialized( proxy ) );
TestEntity testEntity = session.find( TestEntity.class, 1 );
assertEntityLockMode( testEntity, LockModeType.OPTIMISTIC, session );
assertEntityLockMode( testEntity, LockModeType.NONE, session );
// batching is enabled because LockMode = NONE, so the proxy has been initialized
assertTrue( Hibernate.isInitialized( proxy ) );
assertEntityLockMode( proxy, LockModeType.OPTIMISTIC, session );
assertEntityLockMode( proxy, LockModeType.NONE, session );
}
);
assertNoLokIsApplied( scope );
@ -108,7 +108,7 @@ public class BatchAndLockTest {
scope.inTransaction(
session -> {
TestEntity testEntity = session.find( TestEntity.class, 1, LockModeType.NONE );
assertEntityLockMode( testEntity, LockModeType.OPTIMISTIC, session );
assertEntityLockMode( testEntity, LockModeType.NONE, session );
}
);
assertNoLokIsApplied( scope );
@ -122,11 +122,11 @@ public class BatchAndLockTest {
assertFalse( Hibernate.isInitialized( proxy ) );
TestEntity testEntity = session.find( TestEntity.class, 1, LockModeType.NONE );
assertEntityLockMode( testEntity, LockModeType.OPTIMISTIC, session );
assertEntityLockMode( testEntity, LockModeType.NONE, session );
// batching is enabled because LockMode = NONE, so the proxy has been initialized
assertTrue( Hibernate.isInitialized( proxy ) );
assertEntityLockMode( proxy, LockModeType.OPTIMISTIC, session );
assertEntityLockMode( proxy, LockModeType.NONE, session );
}
);
assertNoLokIsApplied( scope );