Hi,
I know it is a very late response but maybe someone will find this usefull:
(It sets a BLOB)
Note that Hibernate session must be flushed before calling this code.
stmt = HibernateUtil.getSession().connection().createStatement();
String sqlText =
"SELECT pic_data " +
"FROM picture " +
"WHERE id=" + picture.getId() + " FOR UPDATE";
rset = stmt.executeQuery(sqlText);
boolean retnext = rset.next();
if ( retnext == false ) throw new Exception("picture row not found: " + picture.getId());
Object oraBLOB = WSCallHelper.jdbcCall(null, rset, "getBlob", new Object[] {new Integer(1)}, new Class[] {int.class});
logger.debug("WSCallHelper.jdbcCall returned:" + oraBLOB);
byte[] buffer = new byte[4096];
// avoid including oracle classes
Method mthd = oraBLOB.getClass().getMethod("getBinaryOutputStream", new Class[]{});
OutputStream outputStream = (OutputStream)mthd.invoke(oraBLOB, new Object[]{});
int length = -1;
while ((length = is.read(buffer)) != -1) {
outputStream.write(buffer, 0, length);
outputStream.flush();
}
rset.close();
stmt.close();