I am using grailsGrails and i am quite surprised by the way has manyhasMany relationships work. I have a typical has manyhasMany relationship where the parent id is in the child table. When iI insert a child and try to save it through the parent object..The, the parent objectsobject's version id gets incremented. My question is why: Why should the parent's version id change when there is a change only in the child object.?
class Parent { static hasMany = [children: child] } class child { string name Parent parent static belongsTo = [Parent] } def p = Parent.get(1) p.addToChildren(new Child(name: "Roy")) p.save() theThe version of pp gets incremented from 0 to 1. Is there any way iI can avoid this in grailsGrails? Due
Due to the change in version ID of the parent iI get a stale object exception. Any help?