title: Groovy/Grails : How to sort the list of objects by id
body: <p>PublicTraining Class </p>
  
  <pre><code>class PublicTraining{
      static hasMany = [trainingOrder: TrainingOrder]
  }
  </code></pre>
  
  <p>and TrainingOrder Class</p>
  
  <pre><code>class TrainingOrder {
      Date createdOn
  
      static mapping = {
          sort id:"asc"
      }
  }
  </code></pre>
  
  <p>if i want to get all the orders for training</p>
  
  <pre><code>def orders = publicTrainingInstance.trainingOrder.sort()
  println orders // [59,58] (id of orders)
  </code></pre>
  
  <p>which does not give sorted orders </p>