0

I have a domain structure like :

Author hasMany Books.

Both the domain has lastUpdated and dateCreated fields. This works fine but the problem is when i add new element (Book) to hasMany collection of Author. Author's lastUpdated also gets changed. So, can i prevent this for this particular case? One of the solution could be to add another field say "UpdatedDate" but that i don't want to go this route.

Thanks in advance.

Anuj Aneja
  • 1,323
  • 11
  • 13

1 Answers1

0

You can try to add method:

 def beforeUpdate() { }

To your Author domain and implement logic of updating lastUpdated field there. See related link.

Maciej Łebkowski
  • 3,837
  • 24
  • 32
rxn1d
  • 1,236
  • 6
  • 18