1
JavaBeginner#spring
Batch processing groups multiple SQL statements together and sends them to the database in a single network round trip using addBatch() and executeBatch(), significantly improving performance for bulk inserts/updates.
PreparedStatement ps = conn.prepareStatement("INSERT INTO logs(msg) VALUES(?)");
for (String msg : messages) { ps.setString(1, msg); ps.addBatch(); }
ps.executeBatch();