I have three lists of entities that i'm trying to save to the database.
in total it's about 1000 entites it have to persist.
entityRepo.save(EntityList);
However this takes 4-5 minutes to complete. - And i noticed its doing some selects before the inserts, I assume it's hibernate dirty checking to see if it needs to update or insert.
Anyway to disable this and improve the speed of hibernate insert ?
been looking into flushing but not sure how to do it when saving an entire list at once ?
If all the entities are the same then you should turn on batch-inserts. Here's a couple of articles to get you started. It's primarily just adding some configuration.
http://memorynotfound.com/hibernate-jpa-batch-insert-batch-update-example/ https://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/chapters/batch/Batching.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With