What version of iBATIS are you using? May be you need some jar file update. The getResult() method did work for me as mentioned by Jeff, without any compilation err. I have a jar file for iBATIS 2.3.0.
"Chetan Nayak" <[EMAIL PROTECTED]> 01/07/2008 05:43 AM Please respond to [email protected] To [email protected] cc Subject Re: Exception "XMLType mapping only supported for Oracle RDBMS" Hi Jeff , I tried doing what you said , Here is the error i get now. java.lang.NoSuchMethodError: com.ibatis.common.jdbc.logging.ResultSetLogProxy: method getRs()Ljava/sql/ResultSet; not found at com.cerner.clm.dao.sqlmap.XMLTypeHandlerCallback.getResult (XMLTypeHandlerCallback.java:62) at com.ibatis.sqlmap.engine.type.CustomTypeHandler.getResult(CustomTypeHandler.java:52) at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResultMappingValue(BasicResultMap.java :611) at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:344) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:381) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults (SqlExecutor.java:301) at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:190) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:173) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java :123) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95) Any idea's how to solve this. Thanks Chetan On 12/27/07, Jeff Butler <[EMAIL PROTECTED]> wrote: Here's how to get the real resultset from a the proxied class: public Object getResult(ResultGetter getter) throws SQLException { ResultSet rs = getter.getResultSet(); if (Proxy.isProxyClass(rs.getClass())) { InvocationHandler ih = Proxy. getInvocationHandler(rs); if (ih instanceof ResultSetLogProxy) { ResultSet realResultSet = ((ResultSetLogProxy) ih).getRs(); // do something here... } } } It's ugly - but it works. Jeff Butler On Dec 26, 2007 11:37 AM, <[EMAIL PROTECTED]> wrote: Jeff, I did read your posting at http://www.mail-archive.com/[email protected]/msg06898.html already before sending this question. I could not understand how/where do I modify the code to consider proxy class. My getOpaqueValue() displays ResultSet class is: $Proxy2, not ResultSetLogProxy. The program DOES WORK if I turn off logging. I tried something like this: public Object getResult(ResultGetter getter) throws SQLException { // if (getter.getResultSet () instanceof OracleResultSet) { OPAQUE opaqueValue = getOpaqueValue(getter); if (opaqueValue != null) { XMLType xmlResult = XMLType.createXML (opaqueValue); return xmlResult.getDOM(); } else { return null; } // } else { // throw new UnsupportedOperationException("XMLType mapping only supported for Oracle RDBMS"); // } } private OPAQUE getOpaqueValue(ResultGetter getter) throws SQLException { java.sql.ResultSet rs = getter.getResultSet(); System.out.println ("ResultSet class is: " + rs.getClass()); // ResultSetLogProxy rsProx = (ResultSetLogProxy)rs; OracleResultSet ors = (OracleResultSet)ResultSetLogProxy.newInstance(rs); //--- THROWS ClassCastException OPAQUE op = null; if (getter.getColumnName() != null) { op = ors.getOPAQUE(getter.getColumnName()); } else { op = ors.getOPAQUE(getter.getColumnIndex()); } return op; } Thanks "Jeff Butler" <[EMAIL PROTECTED]> 12/26/2007 12:24 PM Please respond to [email protected] To [email protected] cc Subject Re: Exception "XMLType mapping only supported for Oracle RDBMS" The code in the wiki article does not take into account the fact that iBATIS logging changes the normal classes to proxy classes. First thing to do is turn off logging to see it will work. Second thing, the code must be modified to account for the proxy class if logging is enabled (add another instanceof check for the proxy class, then unwind the embedded "real" class). See here for more information: http://www.mail-archive.com/[email protected]/msg06898.html Jeff Butler On Dec 26, 2007 10:26 AM, < [EMAIL PROTECTED] > wrote: I am using code as directed in this url: http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java It throw UnsupportedOperationException("XMLType mapping only supported for Oracle RDBMS"); I have logger set to DEBUG mode. I tried displaying class from ResultSet like : java.sql.ResultSet rs = getter.getResultSet(); System.out.println("ResultSet class is: " + rs.getClass()); The cosole displays [20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Executing Statement: SELECT OTM, SEQUENCE, MESSAGETYPE, MESSAGEID, STATUS, PROCESSED_TIME, CREATED FROM OTM_XML [20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Parameters: [] [20 Dec 2007 15:15:05] DEBUG [PreparedStatement] {pstm-100001} Types: [] [20 Dec 2007 15:15:05] DEBUG [ResultSet] {rset-100002} ResultSet ResultSet class is: class $Proxy2 I am using JDeveloper 10.1.3.1 What should I change in my code to make it working? Thanks ****************************************************************************** ATTENTION ATTENTION ATTENTION ATTENTION ATTENTION Our domain name is changing. Please take note of the sender's e-Mail address and make changes to your personal address list, if needed. Both domains will continue to work, only for a limited time. ****************************************************************************** This email and any files transmitted with it are intended solely for the use of the individual or agency to whom they are addressed. If you have received this email in error please notify the Navy Exchange Service Command e-mail administrator. This footnote also confirms that this email message has been scanned for the presence of computer viruses. Thank You! ******************************************************************************
