title: map existing mysql database with gorm
body: <p>I'm trying to map a (small part of a) Joomla MySQL database using GORM with Grails 2.0.</p>
  
  <p>I'm reading a book on the argument (Grails) and googling the web for tech article, but I still need a good reference to map Groovy/Java types to MySQL fields.</p>
  
  <p>I'm starting with a simple table <code>jos_bannerclient</code>.</p>
  
  <pre><code>class BannerClient {
      String name
      String contact
      String email
      String notes
      String editor = ''
  
      static constraints = {
          name(blank:false)
          contact(nullable:true)
          email(nullable:true)
          notes(nullable:true)
          editor(nullable:true)
      }
  
      static mapping = {
          datasource 'joomla'
          table 'jos_bannerclient'
          id column:'cid', type:'int'
          notes column:'extrainfo', type:'text'
          version false
      }
  }
  </code></pre>
  
  <p>At this point the record is generated in the database but if I save the domain with <code>failOnError:true</code> I get this error: <code>java.lang.IllegalArgumentException</code>.</p>
  
  <p>I've problems mapping the checked_out <code>TINYINT</code> field. The only thing for GORM to validate that field is to declare it as <code>Boolean</code>, why it doen't work with <code>Byte</code>?</p>
  
  <p>I've also some doubt on how to map a MySQL <code>TIME</code> field like <code>checked_out_time</code>.</p>
  
  <p>I've also read some part of Hibernate documentation, but still not gaining the needed knowledge to accomplish this task!</p>
  
  <p>Anyone can help please?</p>