I want to use the lastUpdated field of a Grails domain to implement a "what objects have recently changed" view. However my domain has a has-many association which when something is added will cause the lastUpdated value to be updated.
E.g.:
class Author {
string name
Date lastUpdated
static hasMany = [ books : Book ]
}
Adding a new book (author.addToBooks(newBook)) will update lastUpdated.
Questions:
- Why is
lastUpdatednot updated when a book is removed? - Is there a way to prevent
lastUpdatedto be changed when a book is added to the list? (Let's say that a new book does not count as a change to the author in my domain model)
Thanks!