Spring JdbcTemplateのBatchUpdateを使う
Spring JdbcTemplateのBatchUpdateを使う
Spring JdbcTemplate batchUpdate() example
このBatchUpdate、なぜか速度上がらず( ;∀;)
調べてみたところ、並列処理にしていても rewriteBatchedStatementsをtrueにしないとBulkInsertは行われないとのこと。 おこなわれないんかーい!だめなんかーい!
Java SpringでBulkInsertする
・接続プロパティにrewriteBatchedStatements=trueを指定すること
・サーバサイドPreparedStatementを使わないこと(useServerPrepStmts=trueにしないこと)
ブログに記載のある上記の条件を満たすことで、下記のBulkInsetに変更してくれるそうです。
insert into hoge (id, data) values (1, 'text01'), (2, 'text02), .... ````