Hi, My requirement is to pass an blob object to an oracle procedure. I am able to save & retrieve a blob object using hibernate in a table when the blob is inside a Entity. However when i try to pass a blob to a procedure i get the exception "java.lang.ClassCastException: org.hibernate.lob.SerializableBlob incompatible with oracle.sql.BLOB"
My code consist of: session.doWork(new Work() { public void execute(Connection connection) throws SQLException { CallableStatement call = connection.prepareCall("{call ORACLE_STORED_PROCEDURE(?)}"); call.setBlob(1, Hibernate.createBlob(byteData));// byteData is a byte[] call.execute(); } });
I am using Hibernate 3.3.2.GA & oracle 10g-ojdbc14.jar.
The stacktrace is: java.lang.ClassCastException: org.hibernate.lob.SerializableBlob incompatible with oracle.sql.BLOB at oracle.jdbc.driver.OraclePreparedStatement.setBlobInternal(OraclePreparedStatement.java:5749) at oracle.jdbc.driver.OracleCallableStatement.setBlob(OracleCallableStatement.java:4361) at com.MyDAO$1.execute(MyDAO.java:1437) at org.hibernate.impl.SessionImpl.doWork(SessionImpl.java:1858) at MyDAO.method1(MyDAO.java:1434)
Pls provide a resolution.
|