Hi, I'm using hibernate 2.1.8 to persist some blobs in an oracle 9i database. For
this, I implemented something similar to what says in the hibernate wiki,
http://www.hibernate.org/73.html, mapping a Blob to a char[]. I tested this on Jboss
4.0.3SP1 and works perfectly, but on JBoss 3.2.8SP1 it fails. The error happens when
Hibernate calls the method that converts the blob to a char[], nullSafeSet(), on the
line:
oracle.sql.BLOB blob = oracle.sql.BLOB.createTemporary(
|
((org.jboss.resource.adapter.jdbc.WrappedConnection)st.getConnection()).getDelegate(),
| false, oracle.sql.BLOB.DURATION_SESSION);
In this line, a temporary oracle blob gets created from the database connection asociated
to the java.sql.PreparedStatement "st" created by Hibernate. The method should
receive a java.sql.Connection object and, since hibernate uses a jboss datasource, the
connection's class results to be org.jboss.resource.adapter.jdbc.WrappedConnection.
This caused a ClassCastException. To get it working, I had to call
WrappedConnection.getUnderlyingConnection(); this returns a oracle.jdbc.OracleConnection
which in turn implements java.sql.Connection, so it should be accepted. As I said before,
this works on Jboss 4.x, but on Jboss 3.2.x it keeps throwing a ClassCastException!
Does anyone know how can I get this to work on 3.2.x, since it works in later versions?
Thanks!
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3965931#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...