org.springframework.jdbc.core.ParameterizedPreparedStatementSetter Java Examples
The following examples show how to use
org.springframework.jdbc.core.ParameterizedPreparedStatementSetter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JdbcBookRepository.java From spring-boot with MIT License | 7 votes |
@Override public int[][] batchUpdate(List<Book> books, int batchSize) { int[][] updateCounts = jdbcTemplate.batchUpdate( "update books set price = ? where id = ?", books, batchSize, new ParameterizedPreparedStatementSetter<Book>() { public void setValues(PreparedStatement ps, Book argument) throws SQLException { ps.setBigDecimal(1, argument.getPrice()); ps.setLong(2, argument.getId()); } }); return updateCounts; }
Example #2
Source File: JdbcBookRepository.java From spring-boot with MIT License | 6 votes |
@Transactional @Override public int[][] batchInsert(List<Book> books, int batchSize) { int[][] updateCounts = jdbcTemplate.batchUpdate( "insert into books (name, price) values(?,?)", books, batchSize, new ParameterizedPreparedStatementSetter<Book>() { public void setValues(PreparedStatement ps, Book argument) throws SQLException { ps.setString(1, argument.getName()); ps.setBigDecimal(2, argument.getPrice()); } }); return updateCounts; }
Example #3
Source File: BatchJdbcTemplate.java From buffer-slayer with Apache License 2.0 | 4 votes |
public <T> int[][] batchUpdate(String sql, Collection<T> batchArgs, int batchSize, ParameterizedPreparedStatementSetter<T> pss) throws DataAccessException { return delegate.batchUpdate(sql, batchArgs, batchSize, pss); }
Example #4
Source File: KratosJdbcTemplate.java From kratos-1 with Apache License 2.0 | 4 votes |
@Override public <T> int[][] batchUpdate(String sql, Collection<T> batchArgs, int batchSize, ParameterizedPreparedStatementSetter<T> pss) throws DataAccessException { return super.batchUpdate(sql, batchArgs, batchSize, pss); }