Issues

Select view

Select search mode

 
50 of

cascade remove does not correctly remove all entities with a mappedBy relation when the ManyToOne side is a EmbeddedId

Description

See the original discussion at

 

When clearing collections on both sides of a bidirectional relationship within the same transaction without an intermediate persistAndFlush(), relationship entities are not properly removed from the database.

ProjectEntity has

after creating three projects and connecting them (pe1 -> pe2 -> pe3) I use the following code to disconnect pe2 from pe1 and pe3:

Expected behavior

Clearing collections on both sides of a bidirectional relationship within the same transaction without an intermediate persistAndFlush(), should properly remove entities from the database.

Actual behavior

It seems that only for the collection that was cleared last (incomingRelations) the orphanRemoval works as expected.

How to Reproduce?

I created a repo to reproduce the bug:

Execute the only test to reproduce it

Output of uname -a or ver

No response

Output of java -version

Java version: 21.0.6, vendor: Inc., runtime: /Users/.../Library/Java/JavaVirtualMachines/corretto-21.0.6/Contents/Home

Quarkus version or git rev

3.19.4

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d26018693

Details

Assignee

Reporter

Affects versions

Priority

Created 1 hour ago
Updated 1 hour ago

Activity

Show:

Flag notifications