-
Notifications
You must be signed in to change notification settings - Fork 199
Closed
Description
Domain classes are marked as dirty when any operations are done on the grails.web.databinding.WebDataBinding#getProperties, without actually changing any property.
Task List
- Steps to reproduce provided
- Stacktrace (if present) provided
- Example that reproduces the problem uploaded to Github
- Full description of the issue provided (see below)
Steps to Reproduce
- Create a simple grails 4.0.1, gorm 7.0.2.RELEASE (with mongo plugin support) application
- Create 2 simple domain classes
import groovy.transform.AutoClone
@AutoClone
class BuggyCard implements Serializable {
BuggyCardProfile buggyCardProfile
static hasOne = [buggyCardProfile: BuggyCardProfile]
static constraints = {
buggyCardProfile nullable: true
}
}
class BuggyCardProfile implements Serializable {
BuggyCard buggyCard
static constraints = {
buggyCard nullable: true
}
}
- Insert entities in db
BuggyCard.withNewTransaction {
def card = new BuggyCard()
card.save(flush: true, failOnError: true)
def profile = new BuggyCardProfile()
profile.buggyCard = card
profile.save(flush: true, failOnError: true)
}
- Create one simple controller with an endpoint.
@Secured(['IS_AUTHENTICATED_ANONYMOUSLY'])
def buggyEndpoint() {
// todo replace this with the id of the created buggyCard from step 3
def buggyCard = BuggyCard.findById(1)
def set = buggyCard.properties.entrySet()
log.info("is dirty? " + buggyCard.isDirty())
return respond("result": "result")
}
- Notice that the entity is dirty.
Expected Behaviour
Domain classes should not become dirty without actual changes on them.
Actual Behaviour
Domain classes are marked as dirty without actual changes on them.
Environment Information
- Operating System: macOS Catalina 10.15.4
- Grails Version: 4.0.1
- JDK Version: 1.8.0_231
- Container Version (If Applicable): N/A
Example Application
- TODO: link to github repository with example that reproduces the issue