title: Changing primary key id to String type in Grails
body: <p>My Grails 2.0 app has a User domain object defined:</p>
  
  <pre><code>class User {
  
  static mapping = {
      table "dt_user"
      columns {
        id column:'user_id', generator:'assigned', type:'string'
      }
  }
  </code></pre>
  
  <p>When I try to save a new User in my BootStrap file like so:</p>
  
  <pre><code>def user = new User(id: "smith").save(failOnError:true)
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>| Error 2012-01-13 10:09:42,659 [main] ERROR property.BasicPropertyAccessor  - IllegalArgumentException in class: User, setter method of property: id
  | Error 2012-01-13 10:09:42,660 [main] ERROR property.BasicPropertyAccessor  - expected type: java.lang.Long, actual value: java.lang.String
  </code></pre>
  
  <p>I also tried changing the User class to this:</p>
  
  <pre><code>class User {
      static mapping = {
          table "dt_user"
          columns {
              id column:'user_id', generator:'assigned', type:'string', name:'id'
          }
      }
  
      String id 
  }
  </code></pre>
  
  <p>which made the above errors go away. However I found that this resulted in ids being generated automatically, completely ignoring the <code>generator: 'assigned'</code> clause.</p>
  
  <p>What am I doing wrong here?</p>