Hi all,
i'm trying to use the HibernetXMLType ina an application deployed under jboss Application Server 4.2.2 and i have big problem casting the given ResultSet to OracleResultSet.
Following my custom code:
public Object nullSafeGet( ResultSet rs, String [ ] names, Object arg2 )
throws HibernateException, SQLException
{
XMLType xmlType = null;
Document doc = null;
try {
OPAQUE op = null;
System.out.println("############################## rs: "+rs); // here i can see: oracle.jdbc.driver.OracleResultSetImpl
System.out.println("############################## RUNTIME CLASS: "+rs.getClass().getName());// here i can see: org.jboss.resource.adapter.jdbc.WrappedResultSet
ResultSet underlyingRs = null;
get
try {
org.jboss.resource.adapter.jdbc.WrappedResultSet wrappedRs = (org.jboss.resource.adapter.jdbc.WrappedResultSet)rs;
underlyingRs = wrappedRs.getUnderlyingResultSet();
} catch (ClassCastException e) {
// My Exception
e.printStackTrace();
}
OracleResultSet ors = null;
if (underlyingRs instanceof OracleResultSet) {
ors = (OracleResultSet)rs;
} else {
throw new UnsupportedOperationException("ResultSet needs to be of type OracleResultSet");
}
op = ors.getOPAQUE(names[0]);
if(op != null) {
xmlType = XMLType.createXML ( op );
}
doc = xmlType.getDOM();
}finally {
if (null != xmlType) {
xmlType.close();
}
}
return doc;
}
i have tryed to customize this method because using the original one the given ResultSet is not recognized as instance of OracleResultSet and obviously nothing work...
Someone can please help me?
if my explanation was not clear let's tell and i will try to give more details.
Cheers,
Carlo
|