Persisting and loading an entity with a null all-delete-orphan collection results in error

Description

When persisting ant entity Parent with a collection children, mapped as all-delete-orphan, set to null and then loading the same entity in a query results in:

org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: org.hibernate.bugs.domain.Parent.children

When children is non null the problem doesn’t happen.

Sample code:

Persisting and querying:

Test case attached.

Attachments

1

Activity

Show:

Andrea Boriero June 5, 2024 at 7:30 AM

Hi ,

I tried the test you provided with 6.5.2 and it passes.

Israel Rios June 4, 2024 at 7:34 PM

This problem reappeared on 6.5.2.

Fixed

Details

Assignee

Reporter

Worked in

Components

Fix versions

Affects versions

Priority

Created March 17, 2023 at 2:42 PM
Updated June 5, 2024 at 7:30 AM
Resolved March 24, 2023 at 3:27 PM