title: Grails/MySQL field length constraint
body: <p>I am using Grails 1.3.7 and MySQL <s>5.1.</s>5.5. I have a class that defines a string property like this:</p>
  
  <pre><code>class Topic {
      String name;
      User owner;
      // other fields
  
      static constraints = {
          name(blank: false, maxSize: 1024, unique: ['owner'])
      }
  }
  </code></pre>
  
  <p>This works fine with the in-memory database, but when I deploy the WAR file, I get this error:</p>
  
  <pre><code>12/06/07 17:09:48 ERROR hbm2ddl.SchemaUpdate: Unsuccessful: create table topic (id bigint not null auto_increment, version bigint not null, date_created datetime not null, description longtext, name longtext not null, owner_id bigint not null, primary key (id), unique (owner_id, name))
  12/06/07 17:09:48 ERROR hbm2ddl.SchemaUpdate: BLOB/TEXT column 'name' used in key specification without a key length
  </code></pre>
  
  <p>If I change the <code>maxSize</code> spec to 255, everything works correctly. </p>
  
  <p>My reading of the documentation was that MySQL could not figure out the key length by default to enforce the uniqueness constraint; why doesn't grails pass the maxSize value for that purpose?</p>
  
  <p>UPDATE: 8 Jun 2012
  Here is the hibernate specification I am using:</p>
  
  <pre><code>hibernate {
      cache.use_second_level_cache=true
      cache.use_query_cache=true
      cache.provider_class='net.sf.ehcache.hibernate.EhCacheProvider'
  }
  </code></pre>
  
  <p>I am using com.mysql.jdbc.Driver with the <code>mysql-connector-java-5.1.7-bin.jar</code> library with MySQL 5.5. </p>