| Hibernate seems to have an issue under the following scenario with the following simple mappings (all lazy)
- * Parent -> OneToMany -> Child
- Child -> ManyToOne -> Parent
- Enable batch fetching
- Read in Parent1 and a (non-related) Child
- Lock and refresh the original Parent1 / this will prompt a batch fetch of the other child's ParentX
- At this time, it appears the original Parent1 is "duplicated" in the session cache
- Directly read in a Child associated with Parent1
- Refresh the original reference to Parent1 causing Hibernate to now directly see two Parent1s in the cache
- Flush the session
Note I believe this issue is also related to HHH-12268 Open which still also exists in the latest 5.x versions. |