Thread:
 ClassCastException using Hibernate2 Blobs 
 dannwebster   25 Mar 2004, 01:15 
 Re: ClassCastException using Hibernate2 Blobs 
 dannwebster   26 Mar 2004, 19:23 
 Re: ClassCastException using Hibernate2 Blob... 
 leenamba   30 Mar 2004, 11:21 
 Re: ClassCastException using Hibernate2 B... 
 alu1344   08 Jun 2004, 09:20 
 Re: ClassCastException using Hibernate2 Blobs 
 zetacode   21 Nov 2006, 11:09 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: zetacode (21 Nov 2006, 11:09) Replies: 0, Views: 21926
Subject: Re: ClassCastException using Hibernate2 Blobs
>This code always throws a ClassCastException on this line:

><code>
>oracle.sql.BLOB blob = (oracle.sql.BLOB) foo.getBlob();
></code>

I'm using Hibernate3 and I was experiencing the same problem, but in my
cas e I got a ClassCastException of type org.hibernate.lob.SerializableBlob.
I found a solution in this way:

[...]
org.hibernate.lob.SerializableBlob sBlob =
(org.hibernate.lob.SerializableBlob)foo.getBlob();
oracle.sql.BLOB blob = (oracle.sql.BLOB)sBlob.getWrappedBlob();
java.io.OutputStream pw = blob.getBinaryOutputStream();
[...]

Hope it helps
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]