title: Update "lastUpdated" Field in Parent Domain Class in Grails
body: <p>I have a parent domain class the has a <code>hasMany</code> of another domain class. Both the parent and the child domain classes have the <code>lastUpdated</code> and the <code>dateCreated</code> fields. My issue is that when I update a child domain class, I need the parent domain class to reflect that change and update its <code>lastUpdated</code> field as well.</p>
  
  <p>Is there any mapping or other configuration between the parent and child that Grails provides that would implement this feature?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I added the following lines to the child domain class:</p>
  
  <pre><code>def beforeUpdate = {
      parent.lastUpdated = new Date()
  }
  </code></pre>
  
  <p>I also had to make sure in the controller that when I updated a child, I also had to save the parent as well to persist the new <code>lastUpdated</code> field. This seems to work fine, but I would still like to know if there is a mapping or something similar that would do this.</p>