Ejemplo n.º 1
0
 private void retrieveOutputParameters(
     StatementScope statementScope,
     CallableStatement cs,
     ParameterMapping[] mappings,
     Object[] parameters,
     RowHandlerCallback callback)
     throws SQLException {
   for (int i = 0; i < mappings.length; i++) {
     ParameterMapping mapping = ((ParameterMapping) mappings[i]);
     if (mapping.isOutputAllowed()) {
       if ("java.sql.ResultSet".equalsIgnoreCase(mapping.getJavaTypeName())) {
         ResultSet rs = (ResultSet) cs.getObject(i + 1);
         ResultMap resultMap;
         if (mapping.getResultMapName() == null) {
           resultMap = statementScope.getResultMap();
           handleOutputParameterResults(statementScope, resultMap, rs, callback);
         } else {
           SqlMapClientImpl client =
               (SqlMapClientImpl) statementScope.getSession().getSqlMapClient();
           resultMap = client.getDelegate().getResultMap(mapping.getResultMapName());
           DefaultRowHandler rowHandler = new DefaultRowHandler();
           RowHandlerCallback handlerCallback =
               new RowHandlerCallback(resultMap, null, rowHandler);
           handleOutputParameterResults(statementScope, resultMap, rs, handlerCallback);
           parameters[i] = rowHandler.getList();
         }
         rs.close();
       } else {
         parameters[i] = mapping.getTypeHandler().getResult(cs, i + 1);
       }
     }
   }
 }
Ejemplo n.º 2
0
 private void setupResultObjectFactory(StatementScope statementScope) {
   SqlMapClientImpl client = (SqlMapClientImpl) statementScope.getSession().getSqlMapClient();
   ResultObjectFactoryUtil.setResultObjectFactory(client.getResultObjectFactory());
   ResultObjectFactoryUtil.setStatementId(statementScope.getStatement().getId());
 }