Examples of RowCallbackHandler


Examples of org.springframework.jdbc.core.RowCallbackHandler

    final long whenDiff = getEnvironment().getProperty(
        "currency.update.whenDiff", Long.class);
    final boolean willUpdate[] = new boolean[]{false};
    String sql = "SELECT * FROM "+quoteTable("currency")+" WHERE status=?";
    final Map<String, Currency> dataMap = new HashMap<String, Currency>();
    getJdbcOperations().query(sql, new Object[]{Status.ENABLED}, new RowCallbackHandler(){
     
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Currency currency = new Currency();
        currency.setId(rs.getInt("currency_id"));
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

    dataMap.put(0, http);
    dataMap.put(0, https);
   
    String sql = "SELECT store_id, url FROM "+quoteTable("store");
   
    getJdbcOperations().query(sql, new RowCallbackHandler(){
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Integer storeId = rs.getInt("store_id");
        String url = rs.getString("url");
        int pos = url.indexOf("://");
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

    this.txTemplate.execute(new TransactionCallback<Object>() {

      @Override
      public Object doInTransaction(TransactionStatus arg0) {
        namedJdbcTemplate.query(queryGetDocument, idQuery,
            new RowCallbackHandler() {
              boolean bFirstRowRead = false;

              @Override
              public void processRow(ResultSet rs)
                  throws SQLException {
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

      }
      if (log.isInfoEnabled())
        log.info("createConceptGraph(): file not found, creating concept graph from database.");
      final ConceptGraph cg = new ConceptGraph();
      final Set<String> roots = new HashSet<String>();
      this.jdbcTemplate.query(query, new RowCallbackHandler() {
        int nRowsProcessed = 0;

        @Override
        public void processRow(ResultSet rs) throws SQLException {
          String child = rs.getString(1);
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

   */
  public static String getBlob(String id, String tableName, final String columnName, JdbcTemplate jdbcTemplate) {
    String ls_sql = "select " + columnName + " from " + tableName + " where id='" + id + "'";

    // 查询并获得输入流
    jdbcTemplate.query(ls_sql, new RowCallbackHandler() {
     
      public void processRow(ResultSet rs) throws SQLException {
        inStream = rs.getBinaryStream(columnName);
      }
    });
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

            PreparedStatementCreator originalCreator = super.getPreparedStatementCreator(sql, paramSource);
            return new StreamingStatementCreator(originalCreator);
          }
         
        };
        template.query(sql_, params, new RowCallbackHandler() {
          int rowNum=0;
          @Override
          public void processRow(ResultSet rs) throws SQLException {
            handler.handleRow(mapper.mapRow(rs, rowNum++));
          }
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

        new Trade("UK21341EAH46", 112, new BigDecimal("18.12"), "customer2"),
        new Trade("UK21341EAH47", 245, new BigDecimal("12.78"), "customer2"),
        new Trade("UK21341EAH48", 108, new BigDecimal("109.25"), "customer3"),
        new Trade("UK21341EAH49", 854, new BigDecimal("123.39"), "customer4"));

        jdbcTemplate.query(GET_TRADES, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Trade trade = trades.get(activeRow++);

        assertTrue(trade.getIsin().equals(rs.getString(1)));
        assertTrue(trade.getQuantity() == rs.getLong(2));
        assertTrue(trade.getPrice().equals(rs.getBigDecimal(3)));
        assertTrue(trade.getCustomer().equals(rs.getString(4)));
      }
    });

    assertEquals(activeRow, trades.size());

    activeRow = 0;
        jdbcTemplate.query(GET_CUSTOMERS, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Customer customer = customers.get(activeRow++);

        assertEquals(customer.getName(),rs.getString(1));
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

   * only the ordering of these first three columns.
   */
  public void loadBeanDefinitions(String sql) {
    Assert.notNull(this.jdbcTemplate, "Not fully configured - specify DataSource or JdbcTemplate");
    final Properties props = new Properties();
    this.jdbcTemplate.query(sql, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        String beanName = rs.getString(1);
        String property = rs.getString(2);
        String value = rs.getString(3);
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

    given(resultSet.getString("forename")).willReturn("rod");

    params.put("id", new SqlParameterValue(Types.DECIMAL, 1));
    params.put("country", "UK");
    final List<Customer> customers = new LinkedList<Customer>();
    namedParameterTemplate.query(SELECT_NAMED_PARAMETERS, params, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Customer cust = new Customer();
        cust.setId(rs.getInt(COLUMN_NAMES[0]));
        cust.setForename(rs.getString(COLUMN_NAMES[1]));
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

    given(resultSet.next()).willReturn(true, false);
    given(resultSet.getInt("id")).willReturn(1);
    given(resultSet.getString("forename")).willReturn("rod");

    final List<Customer> customers = new LinkedList<Customer>();
    namedParameterTemplate.query(SELECT_NO_PARAMETERS, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Customer cust = new Customer();
        cust.setId(rs.getInt(COLUMN_NAMES[0]));
        cust.setForename(rs.getString(COLUMN_NAMES[1]));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.