Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate.update()


      cleanupAged ( ) ;
      JdbcTemplate jdbcTemplate = getJdbcTemplate ( ) ;

      try
      {
        jdbcTemplate.update ( _insertSQL, new Object[]
          { opUrl, nonce, now } ) ;
        return OK ;
      }
      catch ( DataIntegrityViolationException e )
      {
View Full Code Here


    {
      try
      {
        Date boundary = new Date ( System.currentTimeMillis ( ) - 1000L * _maxAgeSeconds ) ;
        JdbcTemplate jdbcTemplate = getJdbcTemplate ( ) ;
        int cnt = jdbcTemplate.update ( _deleteSQL, new Object[]
          { boundary } ) ;

        if ( _log.isDebugEnabled ( ) ) _log.debug ( "Client nonce cleanup removed " + cnt + " entries" ) ;
      }
      catch ( Exception e )
View Full Code Here

    final String createStatement = Dao.createStatements.get(type);

    KeyHolder holder = new GeneratedKeyHolder();
    try {
      // Create a prepared statement.
      insert.update(new PreparedStatementCreator() {

        @Override
        public PreparedStatement createPreparedStatement(
            Connection connection) throws SQLException {
View Full Code Here

      deleteAllStatementToUse = strat.createDeleteAllStatement();

      Dao.deleteAllStatements.put(type, deleteAllStatementToUse);
    }

    delete.update(deleteAllStatementToUse);
  }

  /**
   * Deletes an instance of T from the database based on the Key.
   *
 
View Full Code Here

      deleteStatementToUse = strat.createDeleteStatement(t);

      Dao.deleteStatements.put(type, deleteStatementToUse);
    }

    delete.update(deleteStatementToUse,
        new Object[] { strat.getPrimaryKeyValue(t) });
  }

  /**
   * Update.
 
View Full Code Here

      updateStatementToUse = strat.createUpdateStatement();

      Dao.updateStatements.put(type, updateStatementToUse);
    }

    update.update(updateStatementToUse, strat.createUpdateObject(t));

    T tNew = select((Integer) strat.getPrimaryKeyValue(t));

    return tNew;
View Full Code Here

  @Before
  public void init() {
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class);
    for (int i = ITEM_COUNT; i > maxId; i--) {
      jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i);
    }
    assertEquals(ITEM_COUNT, JdbcTestUtils.countRowsInTable(jdbcTemplate, "T_FOOS"));
  }

  @After
View Full Code Here

  }

  @After
  public void destroy() {
        JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update("DELETE from T_FOOS where ID>?", maxId);
  }

  @Test
  public void testAsyncReader() throws Throwable {
    List<Throwable> throwables = new ArrayList<Throwable>();
View Full Code Here

  public void init() {
    Assert.notNull(dataSource);
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    maxId = jdbcTemplate.queryForObject("SELECT MAX(ID) from T_FOOS", Integer.class);
    for (int i = ITEM_COUNT; i > maxId; i--) {
      jdbcTemplate.update("INSERT into T_FOOS (ID,NAME,VALUE) values (?, ?, ?)", i, "foo" + i, i);
    }
    assertEquals(ITEM_COUNT, JdbcTestUtils.countRowsInTable(jdbcTemplate, "T_FOOS"));
  }

  @After
View Full Code Here

  }

  @After
  public void destroy() {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    jdbcTemplate.update("DELETE from T_FOOS where ID>?", maxId);
  }

  @Test
  public void testAsyncReader() throws Throwable {
    List<Throwable> throwables = new ArrayList<Throwable>();
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.