Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.RowCallbackHandler


    int after = jdbcTemplate.queryForObject("SELECT COUNT(*) from TRADE", Integer.class);

    assertEquals(before + 5, after);

        jdbcTemplate.query(GET_TRADES, new RowCallbackHandler() {
      private int activeRow = 0;

      @Override
      public void processRow(ResultSet rs) throws SQLException {
        Trade trade = trades.get(activeRow++);
View Full Code Here


    final List<BigDecimal> matches = new ArrayList<BigDecimal>();

    new TransactionTemplate(transactionManager).execute(new TransactionCallback<Void>() {
      @Override
      public Void doInTransaction(TransactionStatus status) {
                jdbcTemplate.query(ALL_CUSTOMERS, new RowCallbackHandler() {
          private int i = 0;

          @Override
          public void processRow(ResultSet rs) throws SQLException {
            final BigDecimal creditBeforeUpdate = creditsBeforeUpdate.get(i++);
View Full Code Here

    customers = Arrays.asList(new Customer("customer1", (credits.get("customer1"))), new Customer("customer2",
        (credits.get("customer2"))), new Customer("customer3", 100500), new Customer("customer4", credits
        .get("customer4")), new Customer("customer5", 32345), new Customer("customer6", 123456));

    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));
        assertEquals(customer.getCredit(), rs.getDouble(2), .01);
View Full Code Here

    customerDebit.setDebit(BigDecimal.valueOf(5));

    writer.write(customerDebit);

        jdbcTemplate.query("SELECT name, credit FROM CUSTOMER WHERE name = 'testName'",
        new RowCallbackHandler() {
          @Override
          public void processRow(ResultSet rs) throws SQLException {
            assertEquals(95, rs.getLong("credit"));
          }
        });
View Full Code Here

  @Test
  @Transactional
  public void testSavePlayer(){
    playerDao.savePlayer(player);
        jdbcTemplate.query(GET_PLAYER, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        assertEquals(rs.getString("PLAYER_ID"), "AKFJDL00");
        assertEquals(rs.getString("LAST_NAME"), "Doe");
        assertEquals(rs.getString("FIRST_NAME"), "John");
View Full Code Here

    trade.setPrice(new BigDecimal("99.69"));
    trade.setQuantity(5);

    writer.writeTrade(trade);

    jdbcTemplate.query("SELECT * FROM TRADE WHERE ISIN = '5647238492'", new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        assertEquals("testCustomer", rs.getString("CUSTOMER"));
        assertEquals(new BigDecimal(Double.toString(99.69)), rs.getBigDecimal("PRICE"));
        assertEquals(5,rs.getLong("QUANTITY"));
View Full Code Here

        Map<String, Set<Integer>> roleSteps = new ConcurrentHashMap<String, Set<Integer>>();
        Map<String, Object> param = new HashMap<String, Object>();
        param.put("sysType", sysType);

        getNamedJdbcTemplate().query("function_auth", param,
                new RowCallbackHandler() {
                    public void processRow(ResultSet rs) throws SQLException {
                        String role = StringUtil.trim(rs.getString("ROLE"));
                        Map<Integer, Integer> authes = roleAuthes.get(role);
                        if (authes == null) {
                            authes = new HashMap<Integer, Integer>();
View Full Code Here

  }

  @Override
  public JobParameters findJobParamsById(String executionId) {
    final Map<String, JobParameter> map = new HashMap<String, JobParameter>();
    RowCallbackHandler handler = new RowCallbackHandler() {

      @Override
      public void processRow(ResultSet rs) throws SQLException {
        ParameterType type = ParameterType.valueOf(rs
            .getString("TYPE_CD"));
View Full Code Here

        break;
      default:
        throw new RuntimeException("Oops!? order="+order);
    }

    jdbcTemplate.query(query, new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet resultSet) throws SQLException {
        int id = resultSet.getInt("id");
        String label = resultSet.getString("label");
        int votes = resultSet.getInt("votes");
View Full Code Here

  public List<Integer> getTopicStats(int topic) {
    final List<Integer> res = Lists.newArrayList(0, 0);

    jdbcTemplate.query(
            "SELECT watch, count(*) FROM memories WHERE topic=? GROUP BY watch",
            new RowCallbackHandler() {
              @Override
              public void processRow(ResultSet rs) throws SQLException {
                if (rs.getBoolean("watch")) {
                  res.set(0, rs.getInt("count"));
                } else {
View Full Code Here

TOP

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

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.