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: leenamba (30 Mar 2004, 11:21) Replies: 1, Views: 40679
Subject: Re: ClassCastException using Hibernate2 Blobs
On 26 Mar 2004 19:23, dannwebster wrote:

><snip>
>This code always throws a ClassCastException on this line:

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

>This problem is actually simply because the offending foo was part of
a
>lazy-loaded object fetched as part of a collection. It goes away if
the
>object itself is refreshed, or if Hibernate.initialize() is called on
>the collection that foo is part of.

I'm using Weblogic 8.1 and I continued to get a ClassCastException at 
that line even after refreshing the object.  The solution was to use 
the Weblogic 8.1 Oracle extensions found in weblogic.jar

<code>
import weblogic.jdbc.vendor.oracle.OracleThinBlob;

...
OracleThinBlob blob = (OracleThinBlob)foo.getBlob();
...
</code>
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]