micronaut-projects / micronaut-projects/micronaut-data

Cascade update does not remove existing link records

Open
#3,722 0 comments 0 reactions 1 assignee View on GitHub

@radovanradic is already working on this.

Since Feb 11, 2026.

Dominant language
Java
Stars
482
Forks
229
Avg merge
1d 7h
Merged PRs (30d)
32

Description

Expected Behavior

In the AssignedUuidManyToManyPersistSpec.groovy#L62 test, it seems like the update is not overwritting the courses, instead it adds courses again:

        c1.name = 'Mathematics'
        s3.courses = [c1]
        studentRepository.update(s3) // This does not remove old courses, but instead adds new ones.
        def found2 = studentRepository.findById(s3.id).orElse(null)

Despite calling update with the same course, the course gets added again and is duplicated.

We have added primary key to the join table columns and this test started failing because it wanted to add the same row twice breaking the primary key constraint.

Actual Behaviour

The test is breaking

Steps To Reproduce

Showed in this PR: https://github.com/micronaut-projects/micronaut-data/pull/3632, as it adds primary key to mapping tables.

Environment Information

No response

Example Application

No response

Version

5.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.