support for database object type in IN/OUT parameters to stored procs
---------------------------------------------------------------------

         Key: IBATIS-121
         URL: http://issues.apache.org/jira/browse/IBATIS-121
     Project: iBatis for Java
        Type: Improvement
  Components: SQL Maps  
    Versions: 2.0.8, 2.0.9, 2.0.9b, 2.1.0, 2.1.1, 2.1.2    
    Reporter: Mark Thomas
    Priority: Minor


Currently, when registering an parameter to be sent/retrieved from a stored 
procedure, there is no way to specify the database object type.  I am proposing 
an extension to BasicParameterMapping to support a "databaseType" parameter and 
a change to the method registerOutputParameters in SqlExecutor.  This method is 
currently as 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()) {
        cs.registerOutParameter(i + 1, mapping.getJdbcType());
      }
    }
  }

I would like it to look like this:

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.getDatabaseType() != null) {
           cs.registerOutParameter(i + 1, mapping.getJdbcType(), 
mapping.getDatabaseType());
        } else {
           cs.registerOutParameter(i + 1, mapping.getJdbcType());
        }
      }
    }
  }

With these changes, iBATIS can handle returning Arrays, Structs, and even Java 
objects from databases (specifically Oracle) using TypeHandlers.


-- 
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

Reply via email to