I have created an example Grails 3.3.11 Application in GitHub that demonstrates the issue. It is configured for a database connection to a MySql database "test" with user "test" and password "test" but can be reconfigured if necessary.
Example Application
https://github.com/dbaylerg/GormIssue
Steps to Reproduce:
- Created a Domain "MyDomain" with an embedded property called "myEmbedded"
- Created a class call "MyEmbedded" with @DirtyCheck annotation and a single Integer property
- Insert a MyDomain record in the database.
- Update the MyDomain.myBedded property and update the record.
- Flush the session and the UPDATE is written to the DB
- Flush the session again and another UPDATE is written to the DB
- Flush the session again and yet another UPDATE is written to the DB.
It is important to note that only when the @DirtyCheck annotation is used on the embedded class will the flushing result in the extra UPDATES
Expected Behaviour
No UPDATES are sent to the database.
Actual Behaviour
UPDATES are sent to the database
Environment Information
grailsVersion=3.3.11
gormVersion=6.1.12.RELEASE
gradleWrapperVersion=3.5
java = openjdk:8