Can anyone give me short description about his spring class
org.springframework.jdbc.core.BatchPreparedStatementSetter
(JavaDoc API Link)
Using the JdbcTemplate batch processing is accomplished by implementing a special interface, BatchPreparedStatementSetter , and passing that in as the second parameter in your batchUpdate method call. This interface has two methods you must implement.
All batch update methods return an int array containing the number of affected rows for each batch entry. This count is reported by the JDBC driver and it's not always available in which case the JDBC driver simply returns a -2 value.
Spring Data JDBC, part of the larger Spring Data family, makes it easy to implement JDBC based repositories. This module deals with enhanced support for JDBC based data access layers. It makes it easier to build Spring powered applications that use data access technologies.
Insert batch example using JdbcTemplate batchUpdate() operation. Batch Insert/Update operations must be Transactional. For batch operations you can use batch update callback BatchPreparedStatementSetter to set parameter values.
It's used for bulk insertion of many rows at once.
This code will illustrate how it's used.
Take a good look at importEmployees
method, and everything should become clear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With