Lock modes are not properly set/retained on an entity when refreshing an entity with lock when batch fetching is enabled.

Description

When batch fetching is enabled, refreshing an entity with a lock request seems to do two things incorrectly:

  1. The lock mode does not seem to be set/retained correctly (related to 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, will still cause this test to fail due to the exception thrown by delazifying the children; I'm aware that issue is still open.

  2. 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

Environment

None

Activity

Show:
Caspian Borison
February 19, 2019, 7:27 PM
Edited

The first issue looks to have been fixed in 5.3.8 as well. Looking through the updated patch notes, it looks like was logged against the exact same scenario.

Should I update the JIRA to reference just the refresh issue mentioned in the second bullet point?

Gail Badner
February 21, 2019, 12:44 AM

, yes, please do update the issue to cover just the remaining issue.

Assignee

Unassigned

Reporter

Caspian Borison

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure