title: How to convert db BLOB column to a byte[] with EntityManager without defining @Entity?
body: <p>I need to pull a BLOB field out of an Oracle database.  I'm using Spring with EntityManager, but I don't want to go through all the effort of defining an @Entity object to represent the table.</p>
  
  <p>I did this something like this ...</p>
  
  <pre><code>String sql = "select * from MY_TABLE where ID = '"+id+"'";
  List&lt;Object&gt; resultList = em.createNativeQuery(sql).getResultList();
  for (Object o : resultList) {
      try {
          if (o != null) {
              Object[] element = (Object[])o;
              byte[] data = (byte[])element[1];
          }
  </code></pre>
  
  <p>... but the problem is the "element[1]" is a "SerialBlobProxy" object, not the array of bytes.</p>
  
  <p>Is there a simple way to convert that "element[1]" into an array of byte[]?</p>