[ 
https://issues.apache.org/jira/browse/IBATIS-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474623
 ] 

Jan Vissers commented on IBATIS-397:
------------------------------------

Put this one on hold!

I'm going to retry things with getObject() and see how far that'll get me.

> Support for Oracle "OPAQUE"
> ---------------------------
>
>                 Key: IBATIS-397
>                 URL: https://issues.apache.org/jira/browse/IBATIS-397
>             Project: iBatis for Java
>          Issue Type: Improvement
>          Components: SQL Maps
>    Affects Versions: 2.2.0, 2.3.0
>            Reporter: Jan Vissers
>
> Based on the custom type handler described in: 
> http://opensource.atlassian.com/confluence/oss/display/IBATIS/XMLTypeHandlerCallback.java
>  we tried to use this handler not only for "regular select" statements but 
> also for "callable statements". As it turns out the current iBatis codebase 
> doesn't allow us to use and/or extend the type handler to fully support 
> Oracle's RDBMS XMLType datatype.
> I've experimented a bit and suggest the following solution:
> 1) Modify the JdbcTypeRegistry class in order for it to contain the 
> ORACLEOPAQUE (much like the ORACLECURSOR already specified)
>        setType("ORACLEOPAQUE", 2007);
> 2) Modify the CallableStatementResultSet class to have it expose its 
> decorated "CallableStatement" instance:
>        public CallableStatement getCs() {
>            return cs;
>        }
> With these two modifications we can declare the mapping as follows:
>      <parameter property="doc" jdbcType="ORACLEOPAQUE" mode="OUT"
>           typeHandler="XMLTypeHandlerCallback" typeName="SYS.XMLTYPE"/>
> We have to change the XMLTypeHandlerCallback (referenced at the top) in order 
> for the getResult() to determine whether to perform work for a 
> CallableStatementResultSet or an OracleResultSet, like so:
>     //The handler getResult
>     public Object getResult(ResultGetter getter) throws SQLException {
>       if (getter.getResultSet() instanceof CallableStatementResultSet) {
>          if (((CallableStatementResultSet) getter.getResultSet()).getCs() 
> instanceof OracleCallableStatement) {
>               OracleCallableStatement ocsmt = (OracleCallableStatement) 
> ((CallableStatementResultSet) getter.getResultSet()).getCs();
>                // go to work
>          } else {
>               throw new UnsupportedOperationException("XMLType mapping only 
> supported for Oracle RDBMS");
>          }
>       } else 
>       if (getter.getResultSet() instanceof OracleResultSet) {
>          // go to work
>       } else {
>          throw new UnsupportedOperationException("XMLType mapping only 
> supported for Oracle RDBMS");
>       }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to