Examples of RowCallbackHandler


Examples of org.springframework.jdbc.core.RowCallbackHandler

  private Importer importer;
 
  private Map<String, String> getCountryNames(String countrycode) {
    if (countryNames == null) {
      countryNames = new HashMap<String, Map<String,String>>();
      template.query("SELECT country_code, name FROM country_name;", new RowCallbackHandler() {
        @Override
        public void processRow(ResultSet rs) throws SQLException {
          countryNames.put(rs.getString("country_code"), DBUtils.getMap(rs, "name"));
        }
      }
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

   
    final BlockingQueue<PhotonDoc> documents = new LinkedBlockingDeque<PhotonDoc>(20);
    Thread importThread = new Thread(new ImportThread(documents));
    importThread.start();

    template.query("SELECT " + selectColsPlaceX + " FROM placex WHERE linked_place_id IS NULL order by geometry_sector; ", new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        PhotonDoc doc = placeRowMapper.mapRow(rs, 0);

        if(!doc.isUsefulForIndex()) return; // do not import document
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

   */
  @Override
  public Set<JobExecution> findRunningJobExecutions(String jobName) {

    final Set<JobExecution> result = new HashSet<JobExecution>();
    RowCallbackHandler handler = new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        JobExecutionRowMapper mapper = new JobExecutionRowMapper();
        result.add(mapper.mapRow(rs, 0));
      }
View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

   * @param executionId
   * @return
   */
  protected JobParameters getJobParameters(Long 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(3));
        JobParameter value = null;

View Full Code Here

Examples of org.springframework.jdbc.core.RowCallbackHandler

  @Test
  public void testSetValues() {

    final List<String> results = new ArrayList<String>();
    jdbcTemplate.query("SELECT NAME from T_FOOS where ID > ? and ID < ?", pss,
        new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        results.add(rs.getString(1));
      }
    });
View Full Code Here

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

Examples of org.springframework.jdbc.core.RowCallbackHandler

    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

Examples of org.springframework.jdbc.core.RowCallbackHandler

    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

Examples of org.springframework.jdbc.core.RowCallbackHandler

    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

Examples of org.springframework.jdbc.core.RowCallbackHandler

  @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
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.