Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.ColumnMapRowMapper


        // Make sure it's properly encoded
        return "sql:" + UnsafeUriCharactersEncoder.encode(query);
    }

    protected List<Map<String, Object>> queryForList(ResultSet rs) throws SQLException {
        ColumnMapRowMapper rowMapper = new ColumnMapRowMapper();
        RowMapperResultSetExtractor<Map<String, Object>> mapper = new RowMapperResultSetExtractor<Map<String, Object>>(rowMapper);
        List<Map<String, Object>> data = mapper.extractData(rs);
        return data;
    }
View Full Code Here


    @SuppressWarnings("unchecked")
    protected Object queryForObject(ResultSet rs) throws SQLException {
        Object result = null;
        if (outputClass == null) {
            RowMapper rowMapper = new ColumnMapRowMapper();
            RowMapperResultSetExtractor<Map<String, Object>> mapper = new RowMapperResultSetExtractor<Map<String, Object>>(rowMapper);
            List<Map<String, Object>> data = mapper.extractData(rs);
            if (data.size() > 1) {
                throw new SQLDataException("Query result not unique for outputType=SelectOne. Got " + data.size() " count instead.");
            } else if (data.size() == 1) {
View Full Code Here

                    }
                    exchange.getIn().setHeader(SqlConstants.SQL_UPDATE_COUNT, total);
                } else {
                    boolean isResultSet = ps.execute();
                    if (isResultSet) {
                        RowMapperResultSetExtractor<Map<String, Object>> mapper = new RowMapperResultSetExtractor<Map<String, Object>>(new ColumnMapRowMapper());
                        List<Map<String, Object>> result = mapper.extractData(ps.getResultSet());
                        exchange.getOut().setBody(result);
                        exchange.getIn().setHeader(SqlConstants.SQL_ROW_COUNT, result.size());
                        // preserve headers
                        exchange.getOut().setHeaders(exchange.getIn().getHeaders());
View Full Code Here

                }
               
                boolean isResultSet = ps.execute();
               
                if (isResultSet) {
                    RowMapperResultSetExtractor mapper = new RowMapperResultSetExtractor(new ColumnMapRowMapper());
                    List<?> result = (List<?>) mapper.extractData(ps.getResultSet());
                    exchange.getOut().setBody(result);
                    // preserve headers
                    exchange.getOut().setHeaders(exchange.getIn().getHeaders());
                } else {
View Full Code Here

   
    // Execute the SQL query and build a results object.  This result
    // will consist of one rowname -> rowvalue map for each row in the
    // result set
    Collection<Map<?,?>> results =
      (Collection<Map<?,?>>) template.query(sqlQuery, new ColumnMapRowMapper());
   
    // build the model
    Map<Object,Object> model = new HashMap<Object,Object>();
    model.put("results", results);
   
View Full Code Here

                }
               
                boolean isResultSet = ps.execute();
               
                if (isResultSet) {
                    RowMapperResultSetExtractor mapper = new RowMapperResultSetExtractor(new ColumnMapRowMapper());
                    List<?> result = (List<?>) mapper.extractData(ps.getResultSet());
                    exchange.getOut().setBody(result);
                    exchange.getIn().setHeader(SqlConstants.SQL_ROW_COUNT, result.size());
                    // preserve headers
                    exchange.getOut().setHeaders(exchange.getIn().getHeaders());
View Full Code Here

  }

  @Override
  public SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta) {
    if (meta.getSqlType() == Types.OTHER && REF_CURSOR_NAME.equals(meta.getTypeName())) {
      return new SqlOutParameter(parameterName, getRefCursorSqlType(), new ColumnMapRowMapper());
    }
    else {
      return super.createDefaultOutParameter(parameterName, meta);
    }
  }
View Full Code Here

    return queryForObject(sql, paramMap, new SingleColumnRowMapper<T>(requiredType));
  }

  public Map<String, Object> queryForMap(String sql, SqlParameterSource paramSource) throws DataAccessException {
    return queryForObject(sql, paramSource, new ColumnMapRowMapper());
  }
View Full Code Here

  public Map<String, Object> queryForMap(String sql, SqlParameterSource paramSource) throws DataAccessException {
    return queryForObject(sql, paramSource, new ColumnMapRowMapper());
  }

  public Map<String, Object> queryForMap(String sql, Map<String, ?> paramMap) throws DataAccessException {
    return queryForObject(sql, paramMap, new ColumnMapRowMapper());
  }
View Full Code Here

  }

  public List<Map<String, Object>> queryForList(String sql, SqlParameterSource paramSource)
      throws DataAccessException {

    return query(sql, paramSource, new ColumnMapRowMapper());
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.ColumnMapRowMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.