title: hibernate + Oracle 11.2 + BLOB
body: <p>I googled a lot and haven't found working issue... In my web app I need to upload large files using ajax. I use ajaxfileupload plugin for it. In my FormBean class I mapped file to InputStream:</p>
  
  <pre><code>private InputStream fileData;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@FormParam("file")
  @PartType("application/octet-stream")
  @JsonIgnore
  public void setFileData(InputStream fileData) {
      this.fileData = fileData;
  }
  </code></pre>
  
  <p>It works fine. I can save this stream into a file and haven't got any problems with java heap size. Now I'm trying to save it into database using Hibernate. Like this:</p>
  
  <pre><code>repFile.setFileData(session.getLobHelper().createBlob(file.getFileData(), 1024L));
  </code></pre>
  
  <p>and when I save repFile object I have <strong>ORA-01461</strong> can bind a LONG value only for insert into a LONG column.
  It works with Oracle 10. But it crashes with Oracle 11.2
  I tried to add lobHandler to my configuration - didn't help</p>
  
  <pre><code>&lt;property name="lobHandler"&gt;
          &lt;bean class="org.springframework.jdbc.support.lob.OracleLobHandler"&gt;
              &lt;property name="nativeJdbcExtractor"&gt;
                  &lt;bean class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"/&gt;
              &lt;/property&gt;
          &lt;/bean&gt;
      &lt;/property&gt;
  </code></pre>
  
  <p>And set batch size to 0 and allow steams</p>
  
  <pre><code>&lt;prop key="hibernate.jdbc.use_streams_for_binary"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.jdbc.batch_size"&gt;0&lt;/prop&gt;
  </code></pre>
  
  <p>That didn't help also... does anyone have a solution for this? Any help would be good. </p>