List of usage examples for org.springframework.jdbc.core ResultSetSupportingSqlParameter getRowMapper
@Nullable
public RowMapper<?> getRowMapper()
From source file:cc.tooyoung.common.db.JdbcTemplate.java
/** * Process the given ResultSet from a stored procedure. * @param rs the ResultSet to process//from w w w . ja va2s . co m * @param param the corresponding stored procedure parameter * @return Map that contains returned results */ @SuppressWarnings("unchecked") protected Map processResultSet(ResultSet rs, ResultSetSupportingSqlParameter param) throws SQLException { if (rs == null) { return Collections.EMPTY_MAP; } Map returnedResults = new HashMap(); try { ResultSet rsToUse = rs; if (this.nativeJdbcExtractor != null) { rsToUse = this.nativeJdbcExtractor.getNativeResultSet(rs); } if (param.getRowMapper() != null) { RowMapper rowMapper = param.getRowMapper(); Object result = (new RowMapperResultSetExtractor(rowMapper)).extractData(rsToUse); returnedResults.put(param.getName(), result); } else if (param.getRowCallbackHandler() != null) { RowCallbackHandler rch = param.getRowCallbackHandler(); (new RowCallbackHandlerResultSetExtractor(rch)).extractData(rsToUse); returnedResults.put(param.getName(), "ResultSet returned from stored procedure was processed"); } else if (param.getResultSetExtractor() != null) { Object result = param.getResultSetExtractor().extractData(rsToUse); returnedResults.put(param.getName(), result); } } finally { JdbcUtils.closeResultSet(rs); } return returnedResults; }