When batch fetching is enabled, refreshing an entity with a lock request seems to do two things incorrectly : # The lock mode does not seem to be set/retained correctly (related to HHH-12257 but this is not the same issue) . ** See HibernateTests.testLazyCollectionAfterBatchFetchRefreshLock in the attached project. ** Note that even if the current assertion failure is resolved in the above test, HHH-12268 will still cause this test to fail due to the exception thrown by delazifying the children; I'm aware that issue is still open. # When other entities are retrieved in the refresh, inspection of the SQL generated shows that *multiple records* are locked. It seems to me that when requesting a lock for a specific entity (even if batch fetching is enabled) only a single entity should be locked.
I have attached the test project that illustrates the above issues. You can also find it on github at https://github.com/caspianb/HibernateRefreshTest [^HibernateRefreshTest.zip] |
|