i have following domain class schema:
class A { static hasMany=[abRelations: AB] }
class B { static hasMany=[abRelations: AB] }
//relation table
class AB{
A a
B b
String someAttribute
}
in some cases i definitely need the abRelations association, e.g. hql queries, criterias, …
my problem is that when i create a new AB entry with
new AB(a: a, b: b, someAttribute: "hello").save()
the version field of A and B gets increased. can i avoid this by adding a special mapping option or something like this? i’m using the afterUpate event in some classes and this event is also fired when a add new relations -> thats my main problem!
You can remove the version field completely by adding the following to the domain class
My understanding is that there’s no way to exercise fine-grained control over when the
versionfield gets incremented. You either have aversionfield and it automatically gets incremented every time a domain object is updated, or you don’t have it at all.