From 1e0e0ac02b8d3f2e3c51f87608ff5ccbf9719395 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 28 Apr 2024 16:37:14 +0200 Subject: [PATCH] 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 --- .../orm/test/jpa/lock/BatchAndLockTest.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/BatchAndLockTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/BatchAndLockTest.java index b08e006153..9e40db845f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/BatchAndLockTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/lock/BatchAndLockTest.java @@ -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 );