An entity that contains a lazy, noop, inverse, one-to-many bag mapping is being flagged as dirty on flush, causing it's version to be updated. Test case(s) attached. The behavior exists when the entity is cached or non-cached. This issue causes intermittent issues on some longer running tasks of our application because the unanticipated update causes lock contention on the table. After some investigation, it appears the bag mappings are causing the entity to be identified as dirty, and the entity is being updated. The only update to the entity is the version. In my testing, the behavior was introduced in Hibernate 4.3.11 and has been in Hibernate 5.0.3 and beyond. I am curious if there is a possible linkage to HHH-9777. |