title: trying to get a blob from an oracle DB using spring3 and mybatis
body: <p>I am working on a project re factoring an old j2ee project to spring3/mybatis</p>
  
  <p>I am currently having problem retrieving a PDF saved as a blob in an oracle table.</p>
  
  <p>The original code returns a byte[] of 135896bytes and the spring/mybatis returns byte[] of 86bytes. So am i doing something incorrectly. Thanks for any help</p>
  
  <p>The original code looked like::</p>
  
  <pre><code>        byte[] filebytes = null;
          con = SvcsConnection.getDBConnection("drugdb");
          String qry = "SELECT pm_blob FROM pdf_master WHERE pm_id_seq = '" +id + "'";
          oracle.sql.BLOB blob;
          stmt = con.createStatement(); 
          rs = stmt.executeQuery(qry);    
          //set mime type
          if(rs.next()) {
              blob = ((OracleResultSet) rs).getBLOB("pm_blob");
              filebytes = blob.getBytes(1, (int) blob.length());                                 
          } 
  </code></pre>
  
  <p>filebytes after the getBytes is <strong>135896bytes</strong></p>
  
  <p>in my spring stuff i have the following</p>
  
  <p><strong>mapper</strong></p>
  
  <pre><code>&lt;select id="getPdfMaster" parameterType="int"  resultType="org.uhs.formulary.pdf_master.model.Pdf_Master"&gt;
      SELECT pm_id_seq, pm_filename, pm_title, pm_blob, pm_update_datetime, pm_update_source,
       to_char(pm_update_datetime, 'MM/DD/YYYY') as pm_update_datetime_str
       FROM pdf_master WHERE pm_id_seq = #{pm_id_seq}
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>DAO</strong></p>
  
  <pre><code>@Repository
  public interface PdfMasterDao {
      public List&lt;Pdf_Master&gt; getPdfMaster(int pm_id_seq);
  }
  </code></pre>
  
  <p><strong>Model (snippet)</strong></p>
  
  <pre><code>public byte[] getPm_Blob() {
      return pmBlob;
  }
  </code></pre>
  
  <p>getPm_Blob returns a byte[] of 86 for the same thing</p>