0
votes

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.

1
You can probably prevent it using the method in: stackoverflow.com/a/6852372/255227 - wwwclaes

1 Answers

0
votes

You can try to add method:

 def beforeUpdate() { }

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