Skip to content

oneToMany orphanRemoval with unique - constraint violation #6776

@akomm

Description

@akomm

I currently do not have time for the test, also because this blocks me: #6738. I try to add one asap.

Issue is the following:

Preconditions:

  • You have an OneToMany with orphanRemoval set from the one-side.
  • On the many-side you have a unique constraint

You do the following in a single transaction/flush:

  1. Remove some entities from the many-side
  2. Create new entities on the many-side

When the column value (unique constraint) on the removed entities (1) equals the column value (unique constraint) on the created entities (2) a constraint violation is raised.

Reason:
The created entities (2) are INSERTed before the removed entities (1) are DELETEd.

Found a fixed, similar issue, just ManyToMany: #2310

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions