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
Test cases have been attached and can also be retrieved from GitHub: [https://github.com/caspianb/HibernateRefreshTest/tree/HHH-14008|https://github.com/caspianb/HibernateRefreshTest/tree/HHH-14008|smart-link]
Note I believe this issue is also related to : [HHH-12268] ( which still also exists in the latest 5.x versions ) . |
|