title: Grails: sort order on one-to-many relationship not working
body: <p>I've got a simple bi-directional one-to-many mapping, as follows, with a default sort order specified on the owning side. However, the sort order doesn't seem to be getting applied? I'm using Grails v2.0.1 (I've now replicated this example with v1.3.7).</p>
  
  <pre><code>package playground
  
  class User {
  
      String name
  
      static hasMany = [ posts : Post ]
  
      static mapping = {
          posts sort:'position'
      }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>package playground
  
  class Post {
  
      int position = 1
      String message
  
      static belongsTo = [ user : User ]
  }
  </code></pre>
  
  <p>this is the integration test code I'm using to exercise it ...</p>
  
  <pre><code>    def User user = new User(name:'bob')
      user.addToPosts(new Post(position:2, message:'two'))
      user.addToPosts(new Post(position:3, message:'three'))
      user.addToPosts(new Post(position:1, message:'one'))
  
      assertTrue user.validate()
      assertFalse user.hasErrors()
      assertNotNull user.save()
  
      for (post in user.posts) {
          log.debug "Post message&gt; ${post.message}"
      }
  </code></pre>
  
  <p>Please put me out of my misery, it's presumably something obvious but I can't see it! Thanks.</p>