title: Grails addTo* clarification
body: <p>I am following the example in Grails in Action. I have an issue understanding how the <code>addTo*()</code> function works.</p>
  
  <p>I have a simple domain: User, Post, Tag with the following relationships:</p>
  
  <ul>
  <li>User 1-to-M Post</li>
  <li>User 1-to-M Tag</li>
  <li>Post M-to-M Tag</li>
  </ul>
  
  <p>When I run the following code (first case):</p>
  
  <pre><code>1.  def user = new User(userId: 'joe', password: 'secret').save()
  2.  def tagGroovy = new Tag(name: 'groovy')
  3.  def tagGrails = new Tag(name: 'grails')
  4.  user.addToTags(tagGroovy)              
  5.  user.addToTags(tagGrails)            
  6.  
  7.  def groovyPost = new Post(content: 'A groovy post')
  8.  user.addToPosts(groovyPost)          
  9.  groovyPost.addToTags(tagGroovy)
  10.         
  11. User.get(1).tags.each {println it.id + " " + it.name}
  12. User.get(1).posts.each {println it.id + " " + it.content + " " + it.dateCreated}
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>null grails
  null groovy
  null A groovy post null
  </code></pre>
  
  <p>And if I change lines 4, 5, and 8 to:</p>
  
  <pre><code>4.  user.addToTags(tagGroovy).save(flush: true)              
  5.  user.addToTags(tagGrails).save(flush: true)    
  8.  user.addToPosts(groovyPost).save(flush: true)
  </code></pre>
  
  <p>I get this:</p>
  
  <pre><code>2 grails
  1 groovy
  1 A groovy post Tue Nov 22 21:00:00 WET 2011
  </code></pre>
  
  <p>Can someone explain why in the first case the <code>id</code> and <code>dateCreated</code> properties are not persisted?</p>