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.
Uff. You can do a lot of things to increase speed.
1.) Use @DynamicInsert and @DynamicUpdate to prevent the DB from inserting non-empty columns and updating changed columns.
2.) Try to insert the columns directly (without using hibernate) into your database to see if hibernate is really your bottleneck.
3.) Use a sessionfactory and only commit your transaction every e.g. 100 inserts. Or only open and close the transaction once and flush your data every 100 inserts.
4.) Use the ID generation strategy "sequence" and let hibernate preallocate (via the parameter allocationsize) the IDs.
5.) Use caches.
Some of this possible solutions can have timing disadvantages when not used correctly. But you have a lot of opportunities.