We are facing one issue while using Hibernate with Oracle XMLType Data type.
Development Environment:
Weblogic 8.1 SP4,
Oracle 10g
Hibernate 3.0
Spring 2.0.4
Requirement: To insert/retrieve XML into XMLType column (Oracle 10g) through Hibernate.
We have got sample implementation of Oracle XMLType for Weblogic as a Container on Hibernate.org (
http://www.hibernate.org/369.html)
While implementing code mentioned in the link, we are getting ClassCasteException:weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl
In implementation of public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException
We are getting OracleResultSet which is wrapped by weblogic.jdbc.wrapper.ResultSet. Following is code snippet.
Code:
public Object nullSafeGet( ResultSet rs, String [ ] names, Object arg2 ) throws HibernateException, SQLException {
OracleResultSet ors = null;
if ( rs instanceof weblogic.jdbc.wrapper.ResultSet ) {
ors = (OracleResultSet) getNativeResultSet ( rs ); //getting ClassCastException
} else if ( rs instanceof OracleResultSet ) {
ors = (OracleResultSet) rs;
} else {
throw new UnsupportedOperationException (
"Only direct support for Weblogic and Oracle drivers. Please check your pool driver." );
}
OPAQUE op = ors.getOPAQUE(names[0]);
oracle.xdb.XMLType xt= oracle.xdb.XMLType.createXML(op);
org.w3c.dom.Document doc = (org.w3c.dom.Document) xt.getDocument();
return (org.w3c.dom.Document) doc;
}
getNativeResultSet () is implementation method of org.springframework.jdbc.support.nativejdbc.WeblogicNativeJdbcExtracor
We are not finding proper solution for the problem. I believe it is issue with OracleResultSet and Weblogic Result set mapping issue. However we are not finding right direction in resolving it.
It would be great help if someone can help us in resolving the issue.
Thanks
Chintan