bug: no update on child values
I found a bug on gormVersion=6.1.7.RELEASE I updated it from 6.1.5.RELEASE where it also happened
example code:
Product.withTransaction {
Pro2t domainObject= Pro2t .get(id)
//domainObject.internal= "something1" // this level updates are ok
domainObject.child.interna2 = "something2" // second level does not triguer update
domainObject.save(flush: true, validate: false)
}
Provide an example that reproduces the issue
She example data structure: would be
package com.my.web
import groovy.transform.CompileStatic
import javax.persistence.*
@CompileStatic
@grails.gorm.annotation.JpaEntity
class Pro2t {
String internal
@Embedded
Re2a child
Re2a getChild() { return (this.@child ?: (this.@child= new Re2a())) }
@GeneratedValue
@Id
Long id
@Version
Long version
}
package com.my.web
import groovy.transform.CompileStatic
import javax.persistence.*
@CompileStatic
@Embeddable
@MappedSuperclass
class Re2a implements Serializable, Cloneable{
Re2a(){}
String internal2
}
I could resolve the issue by manually applying @grails.gorm.dirty.checking.DirtyCheck to the embeddable class.
@graemerocher: Is this behaviour intended? Could it be applied automatically for all classes marked with @javax.persistence.Embeddable? Are transformation like @DirtyCheck part of public API that can be used by custom code?
@DirtyCheck is part of the public API yes and should be applied. We could probably apply for classes marked as Embeddable automatically that would be a nice improvement