Friday, June 17, 2016

Spring JDBC Batch Update Operation Using JdbcTemplate

In the previous example, we have discussed how to use JdbcTemplate to access the MySQL database and perform insert and delete operation. In this tutorial, we will focus on how to insert list of cars into database.

For inserting batch of cars, you need to call insert() method multiple times, the update will be very slow as the SQL statement will be compiled repeatedly. Instead, we can add a new method insertCars() in CarsDao for inserting a batch of Cars.

The JdbcTemplate class offers the batchUpdate() template method for batch update operations. It requires two arguments, a SQL ...
Posted under #Spring. Read full article from Stacktips.
Follow author on twitter https://twitter.com/npanigrahy.