-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Passing Blob object to oracle stored procedure
PostPosted: Fri Nov 12, 2010 4:47 am 
Newbie

Joined: Fri Nov 12, 2010 3:27 am
Posts: 1
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.