title: Grails - sort by the domain relation attribute (using createCriteria())
body: <p>I have two domain classes with 1:n relationship:</p>
  
  <pre><code>import Action
  
  class Task {    
      Action actionParent
      String taskName
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class Action {
      String actionName
  }
  </code></pre>
  
  <p>I have the list of Tasks where I have the column "Action name", I would like to sort this column by Action.actionName. Now I'm using the createCriteria() method [I need to use it because I have more logic for filtering and sorting...], but I'm able to sort only by "Action.id". This method looks like:</p>
  
  <pre><code>def criteria = Task.createCriteria();
  taskList = criteria.list {
      if(parameters.max != null)
          maxResults(parameters.max)
      if(parameters.offset != null)
          firstResult(new Integer(parameters.offset))
      if(parameters.sort != null &amp;&amp; parameters.order)
          order(parameters.sort, parameters.order)
  }
  </code></pre>
  
  <p>Is there any way to sort the domain class data by the relationship attributes?</p>
  
  <p>Thanks for any replay,</p>
  
  <p>Mateo</p>