title: How to use a custom id column in GORM
body: <p>I have a domain object that has a property that i want to be used as the id by GORM, the reason being is that ill be saving lists of this object and i want existing rows to be <strong>updated</strong> if the id already exists in the database</p>
  
  <p>Lets assume that my property i want as the PK is called  <strong>listId</strong></p>
  
  <p>Ive seen several approaches to this, which is best?</p>
  
  <p>1:</p>
  
  <pre><code>id generator: 'identity', column: 'listId'
  </code></pre>
  
  <p>2:</p>
  
  <pre><code>  static mapping = {
      id generator:'assigned'
    }
    def getKey = {
      return listId;
    }
  </code></pre>
  
  <p>or something entirely different?</p>