[ http://issues.apache.org/jira/browse/IBATIS-145?page=comments#action_12312775 ]
ppz4j commented on IBATIS-145: ------------------------------ sure, I have implemented a typehandler to convert the returned oracle varray but the exception persists and is thrown when i try to set this type as output parameter. In the way i have read the code the problem depends on the call to the CallableStatement.registerOutParameter method wrong version. This thesis is supported by the jav a doc as i have already explained. the right code where the exception is not generated follows : private void registerOutputParameters(CallableStatement cs, ParameterMapping[] mappings) throws SQLException { for (int i = 0; i < mappings.length; i++) { BasicParameterMapping mapping = ((BasicParameterMapping) mappings[i]); if (mapping.isOutputAllowed()) { if ( mapping.getTypeName() != null ) { //@added cs.registerOutParameter(i + 1, mapping.getJdbcType(), mapping.getTypeName() ); //@added } else { //@added cs.registerOutParameter(i + 1, mapping.getJdbcType()); } //@added } } best regards > oracle's user-defined objects are not supported as store procedure out > parameters > --------------------------------------------------------------------------------- > > Key: IBATIS-145 > URL: http://issues.apache.org/jira/browse/IBATIS-145 > Project: iBatis for Java > Type: Improvement > Components: SQL Maps > Versions: 2.1.0 > Environment: oracle and maybe any others db that support user defined data > types > Reporter: ppz4j > > we have to call legacy oracle store procedure with named array types as > output parameters. When I try it I get an invalid parameter type exception > This problem arises because to use these params the SQLExecutor class should > call the ?callableStatement.registerOutputParameters? method version with > the typeName param. In fact the java doc of this method suggests "This > version of the method registerOutParameter should be used for a user-defined > or REF output parameter" and "To be portable, however, applications should > always provide these values for user-defined and REF parameters. Although it > is intended for user-defined and REF parameters, this method may be used to > register a parameter of any JDBC type. If the parameter does not have a > user-defined or REF type, the typeName parameter is ignored " > To handle this problem I have made some changes in source code and dtd file, > but I hope that in a next version this problem will be resolved. > > Following the changes that I have made to add this enhancement: > Added property typeName to bean BasicParameterMapping, with set and get > methods. > Added code that load typeName param from xml in SqlMapParser and code that > save it as property of the current instance of mapping. > Changed the SQLExecutor, now before call the > CallableStatement.registerOutputParameter the registerOutputParameters method > checks if the typeName of the given map parameter is not null. If it so it > calls the overloaded method registerOutParameter(int paramIndex,int > sqlType,String typeName) instead of registerOutParameter(int paramIndex,int > sqlType. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira