title: Using Oracle 10g CLOB with Grails 2.0.1
body: <p>I'm working on a project using Oracle 10g and Grails v2.0.1.</p>
  
  <p>I'm trying to use a CLOB data type for a text input field in my Domain class, and it doesn't seem to be working.  My first attempt was based on what I read <a href="http://grails.org/doc/2.0.1/guide/GORM.html" rel="nofollow noreferrer" title="here about GORM">here about GORM</a>, where is says to use <code>type: 'text'</code>, like this example:</p>
  
  <pre><code>class Address {
     String number
     String postCode
     static mapping = {
         postCode type: 'text'
     }
  }
  </code></pre>
  
  <p>Grails mapped that to a <code>LONG</code> data type in my DB, which is <a href="https://stackoverflow.com/questions/3599211/oracle-long-or-clob">not desirable</a></p>
  
  <p>2nd attempt was to try <code>type: 'clob'</code>.  That WAS effective in getting my DB datatype to be CLOB, but resulted in a class cast error because the property itself was defined as a string, i.e. <code>String postCode</code>. (Note that I've never seen <code>type:'clob'</code> in documentation, but I could deduce from the dialect class that <code>clob</code> might be a valid input there)</p>
  
  <p>I subsequently tried defining the property as a <code>java.sql.Clob</code>, i.e. <code>Clob postCode;</code>, and that didn't work at all.  No error messages, but nothing was getting persisted to the DB either.</p>
  
  <p>I took a final step of keeping the <code>Clob</code> approach, but using a transient <code>String</code> property in which the getters/setters attempt to map the transient String value to the persistent Clob field.  But I cannot figure out how to get my string value into the Clob.  Grails doesn't throw an error, but the <code>println()</code> after my attempted assignment never prints.  I've tried using <code>myClob.setString(1, theString)</code> to make an assignment, but with no success.</p>
  
  <p>So to make a long story short, I can't seem to use a Clob in my scenario, and I'm wondering if anyone else has seen this and been able to overcome it.  If so, can you tell me what I might be doing wrong?</p>
  
  <p>OR... is there a way to override the datatype Grails chooses such that I could force it to map <code>postCode type: 'text'</code> to a <code>CLOB</code>?  I'm not proficient with Hibernate, so I'm not sure how to go about that if there's a way.</p>
  
  <p>Side note: prior to our upgrade from Grails 1.3.7 to 2.0.1, I'm pretty sure the <code>type: 'text'</code> did, in fact, map to a CLOB in Oracle.  So this might be new to 2.0.1.</p>