I am trying to insert 100,000 rows in a MYSQL table under 5 seconds using Hibernate(JPA). I have tried every trick hibernate offers and still can not do better than 35 seconds. 1st optimisation : I started with IDENTITY sequence generator which was resulting in 60 seconds to insert. I later abandoned the sequence generator and started assigning the @Id
Tag: batch-insert
How to perform batch update in Spring with a list of maps?
New to Spring, I am trying to insert a List<Map<String, Object>> into a table. Until now I have been using the SqlParameterSource for batch update, which works fine when a java bean is supplied to them. Something like this: However, I tried the same technique with a list of maps in place of a bean, it failed (rightly so). The
Java: Insert multiple rows into MySQL with PreparedStatement
I want to insert multiple rows into a MySQL table at once using Java. The number of rows is dynamic. In the past I was doing… I’d like to optimize this to use the MySQL-supported syntax: but with a PreparedStatement I don’t know of any way to do this since I don’t know beforehand how many elements array will contain.