-->
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.  [ 2 posts ] 
Author Message
 Post subject: ClassCastException Oracle Blob
PostPosted: Thu Mar 10, 2016 6:47 am 
Newbie

Joined: Thu Mar 10, 2016 5:32 am
Posts: 2
Hello I have a problem: when I insert a BLOB field in Oracle, using Hibernate 3.6.1

File hbm.xml:

<class name="org.jbpm.pvm.internal.lob.Lob" table="JBPM4_LOB">
<id name="dbid" column="DBID_">
<generator class="assigned" />
</id>
<version name="dbversion" column="DBVERSION_" />
<property name="blob" type="blob"><column name="BLOB_VALUE_" /></property>
</class>


Error:

Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy219 incompatible with oracle.sql.BLOB
at oracle.jdbc.driver.OraclePreparedStatement.setBlob(OraclePreparedStatement.java:6162) ~[ojdbc6.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setBlob(OraclePreparedStatementWrapper.java:126) ~[ojdbc6.jar:Oracle JDBC Driver version - "11.1.0.7.0-Production"]



how do I fix?

thank you


Top
 Profile  
 
 Post subject: Re: ClassCastException Oracle Blob
PostPosted: Sat Mar 19, 2016 7:46 pm 
Newbie

Joined: Sat Mar 19, 2016 5:41 pm
Posts: 1
I am also getting the same exception. But with clob. I have been struggling with this for the past 2 weeks. documentation is not available. I have a refcusrsor returned from a oracle stored procedure. The code worked well when for the past 2 years with serializedclob in 3.3.2. Now once I upgraded to hibernate 4 and i guess hibernate discontinued with serializedclob and i get this classcast exception. Any help from hibernate experts or development team is highly appreciated. Note i am using @Loc annotation. below is the code and which broke:

if(myResult[6] != null){
templateVersions = new HashSet<TemplateVersion>();
tv = new TemplateVersion();
tv.setTemplateVersionId(((BigDecimal)myResult[6]).longValue());
tv.setTemplateVersionNumber(((BigDecimal)myResult[7]).longValue());
tv.setCreatedDate((Date)myResult[8]);
tv.setVersionDescription((String)myResult[9]);
// oracle.sql.CLOB clob = (oracle.sql.CLOB) myResult[10];
SerializableClob tvContentColb = (SerializableClob)myResult[10];
BufferedReader contentR = new BufferedReader(tvContentColb.getCharacterStream());
StringBuilder rslt = new StringBuilder();
String line = null;
while ((line = contentR.readLine()) != null) {
rslt.append(line);
}
tv.setVersionContent(rslt.toString());
// tv.setVersionContent(rs);
templateVersions.add(tv);
newTemps.setTemplateVersions(templateVersions);
}


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

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.