I have following two domain classes in Grails 1.1.2:
class A implements Serializable {
MyEnumType myField
Date fieldChanged
void setMyField(MyEnumType val) {
if (myField != null && myField != val) {
myField = val
fieldChanged = new Date()
}
}
}
class B extends A {
List children
void setMyField(MyEnumType val) {
if (myField != null && myField != val) {
myField = val
fieldChanged = new Date()
children.each { child -> child.myField = val }
}
}
When I set B instance's myField, I get the setter into the cycle... myField = val line calls setter again instead of assiging the new value.
Any hint how to override the setter correctly? Thanks