-->
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: javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.
PostPosted: Tue Feb 14, 2012 7:35 am 
Newbie

Joined: Tue Feb 14, 2012 7:25 am
Posts: 1
Hi there,

I'm facing this exception.
My code:

Code:
final ReportTemplateAttachment rta = new ReportTemplateAttachment();
FileBlob fb = new FileBlob();
fb.setContentType(attachmentDto.getContentType().getValue());
fb.setCreationDate(sysDate);
fb.setCreationUser(userId);
final SerialBlob blob = new SerialBlob(attachmentDto.getFileVal());//it's a  byte[]
//SerialBlob is of type javax.sql.rowset.serial.SerialBlob
fb.setFileData(blob);
fb.setName(attachmentDto.getFileName());
fb.setLastUpdateDate(sysDate);
fb.setLastUpdateUser(userId);
fb.setLength(blob.length());

....
rta.setFileBlob(fb);

and the object rta will be inserted into another object.

The variable of interest in FileBlob hbm is defined as follows:

Code:
<property name="fileData" type="blob">
            <column name="FILE_DATA" />
</property>

where the type blob is oracle.sql.BLOB

If I change the oracle.sql.BLOB to javax.sql.rowset.serial.SerialBlob in the hbm, I can insert but when I try to get the blob back I get a deserialize exception so this change is not an option.


but when I save the main Object (a cascade operation) I get the following exception:

Code:
org.springframework.jdbc.UncategorizedSQLException:
Hibernate flushing: could not insert: [pt.sc.data.entities.FileBlob];
uncategorized SQLException for SQL
[insert into WP_ADMIN.file_blob (name, content_type, length, file_data, status, creation_user, creation_date, last_update_user, last_update_date, id)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)];
SQL state [null];
error code [0];
An SQLException was provoked by the following failure: java.lang.ClassCastException:
javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB;
nested exception is java.sql.SQLException: An SQLException was provoked by the following failure:
java.lang.ClassCastException: javax.sql.rowset.serial.SerialBlob cannot be cast to oracle.sql.BLOB


Any light on the subject?

Thanks in advance,
mleiria


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.