title: Oracle 11g + Hibernate -> ORA-01461: can bind a LONG value only for insert into a LONG column
body: <p>There is an error in the log that says:</p>
  
  <blockquote>
    <p>ORA-01461: can bind a LONG value only for insert into a LONG column</p>
  </blockquote>
  
  <p>no other useful info really. I tried to follow up on the code, google-d the problem and I think I might have found the problem, but unfortunately I do not have Oracle database or anything really (even the code isn't present to me, I'm writing all this from memory and notes :( )
  So the only thing I can guess based on the code (and lots of googling) is the String mapping to varchar2.
  Some environment info:</p>
  
  <pre><code>Hibernate: 3.2.1.ga
  Driver: ojdbc6-11.2.0.2.0.jar
  Database: 11.2.0.2.0 - 64bit
  </code></pre>
  
  <p>The table has multiple varchar2(300 byte) and one varchar2(4000 byte), lets call this last one TEXT. I checked the entity, and in it's column annotation these fields have a restriction of 300 bytes to its value, even the TEXT (4000 byte) field! So that's one strange point. My wild guess is that a String comes, bigger then 300 BYTE, and this is the error that gets printed into the log when trying to persist (stack trace points where the code tries to persist an instance of this entity). Sadly I only have that log to go on.. :( Is my guess likely? Or it's going to be something else?</p>
  
  <p>Here's the entity field:</p>
  
  <pre><code>@Column(name = "TEXT", nullable = false, length = varcharLength)
  public String getText() {
      return text;
  }
  </code></pre>
  
  <p>Here is the create statement (the essential part anyway):</p>
  
  <pre><code>CREATE TABLE "TABLENAME" 
     (
     "ID" VARCHAR2(300 BYTE) NOT NULL ENABLE, 
     "VERSION" NUMBER(10,0), 
     "TEXT" VARCHAR2(4000 BYTE) NOT NULL ENABLE, 
     "PUBLISH_DATE" DATE NOT NULL ENABLE, 
     PRIMARY KEY ("ID")
     );
  </code></pre>
  
  <p>(And the table has an index on PUBLISH_DATE, if that is relevant at all.)</p>