Issues

Select view

Select search mode

 
50 of

Issue with orphanRemoval = true and FetchType.LAZY in Hibernate 6.6.X.Final

Description

I’ve encountered an issue after upgrading to Hibernate 6.6.9.Final from 6.4.10.Final related to the behavior of orphanRemoval = true when combined with FetchType.LAZY.

Issue Description

In previous Hibernate versions, if I had a lazily-loaded collection with orphanRemoval = true and saved the parent entity without explicitly initializing the collection, Hibernate would not attempt to delete any orphans—unless the collection was explicitly modified.

However, after updating to 6.6.9.Final, it seems that Hibernate attempts to remove orphans, even if the lazy collection was never loaded or accessed. This behavior is unexpected and leads to incorrect deletions.

The last version where this behavior worked as expected (i.e., the test passes) is 6.5.3.Final. From version 6.6.0.Final onward, this issue starts to occur.

Reproducer:


Details

Assignee

Reporter

Worked in

Components

Priority

Created 8 hours ago
Updated 8 hours ago

Activity

Show:
Loading...