Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.ColumnMapRowMapper


                }
               
                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


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

        generatedKeys.clear();
        ResultSet keys = ps.getGeneratedKeys();
        if (keys != null) {
          try {
            RowMapperResultSetExtractor<Map<String, Object>> rse = new RowMapperResultSetExtractor<Map<String, Object>>(
                new ColumnMapRowMapper(), rows.length);
            generatedKeys.addAll(rse.extractData(keys));
          } finally {
            JdbcUtils.closeResultSet(keys);
          }
        }
View Full Code Here

          ResultSet keys = ps.getGeneratedKeys();
          if (keys != null) {
            try {
              RowMapperResultSetExtractor<Map<String, Object>> rse =
                new RowMapperResultSetExtractor<Map<String, Object>>(
                  new ColumnMapRowMapper(), rows.length);
              generatedKeys.addAll(rse.extractData(keys));
            } finally {
              JdbcUtils.closeResultSet(keys);
            }
          }
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

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

  private void assertRowCount(String tableName, int rowCount) {
    assertEquals(tableName, rowCount, jdbcTemplate.queryForInt("select count(*) from " + tableName));
  }

  private void assertEventData(String title, String timeZone, String startTime, String endTime, String slug) {
    Map<String, Object> externalEventData = jdbcTemplate.queryForObject("select event, sourceId, source from ExternalEvent where sourceId=? and source='NFJS'", new ColumnMapRowMapper(), SHOW_ID);
    Long eventId = (Long) externalEventData.get("event");
    assertEquals(Long.valueOf(1), eventId);
    assertEquals(Long.valueOf(SHOW_ID), externalEventData.get("sourceId"));
    assertEquals("NFJS", externalEventData.get("source"));
   
    Map<String, Object> eventData = jdbcTemplate.queryForObject("select id,  title, timeZone, startTime, endTime, slug, description, memberGroup from Event where id=?", new ColumnMapRowMapper(), eventId);
    assertEquals(eventId, eventData.get("id"));
    assertEquals(title, eventData.get("title"));
    assertEquals(timeZone, eventData.get("timeZone"));
    assertEquals(startTime, eventData.get("startTime").toString());
    assertEquals(endTime, eventData.get("endTime").toString());
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.