title: Grails search list with 'like'
body: <p>So I have domain classes</p>
  
  <pre><code>class SalesRep {
     SalesTerritory territory
  }
  class SalesTerritory {
     hasMany=[accounts: AccountCustomer]
     String territoryCode
  }
  
  class AccountCustomer {
     String accountName
     String accountCode
     belongsTo = SalesTerritory
     hasMany=[salesTerritories: SalesTerritory]
  }
  </code></pre>
  
  <p>In the controller, I can get the accounts by:</p>
  
  <pre><code>def salesRep = SalesRep.findBy... // 
  def accounts = salesRep.territory.accounts
  </code></pre>
  
  <p>I would like to do two things:</p>
  
  <p>1) Search for accounts with some string (ex. '%My Account%'), something like below:</p>
  
  <pre><code>def accounts = salesRep.territory.accounts.find("accountName like '%My Account%'")
  </code></pre>
  
  <p>2) Sort accounts</p>
  
  <pre><code>def accounts = salesRep.territory.accounts.sort("accountName")
  </code></pre>
  
  <p>I know I can add static mapping = { sort accountName } in the domain class, but what if I want to sort using a different field such as accountCode. Thanks, I tried using createCriteria, but couldn't get it to work.</p>
  
  <p>Thanks.</p>