apache / apache/grails-core

Updating the compositeId fields does not persist in database

Open
#14,553 3 comments 0 reactions 0 assignees View on GitHub
relates-to: gorm
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

When there is a domain with composite Id, and if one of the field in compositeId is changed, saving the domain (even with flush) will not persist the change to database. Dirty checking works, but the save wont update the values, no update query is being fired in hibernate logs, subsequent select wont find new values. This used to work earlier.

Grails: 3.3.2
Also reproducible with Gorm 6.1.11.BUILD-SNAPSHOT

Attached sample has a **CompositeIdSpec** which reveals the issue
[bugwork-composite-id.zip](https://github.com/grails/grails-data-mapping/files/2297376/bugwork-composite-id.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached sample's CompositeIdSpec and run it against Grails 3.3.2 or Gorm 6.1.11.BUILD-SNAPSHOT to reproduce the missing update query. Trace the composite-ID save and dirty-checking behavior; done means changing one composite-ID field persists and subsequent selects find the updated value.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.