spring - What is the best way to do BULK INSERT using Java? -
i'm trying make app can save lot of structured objects in database. using spring data jpa (with hibernate + mysql (myisam tables + foreign keys)) write code data services easy , pleasant using spring data repositories performance slow.
for example, tried insert 100 records in 1 table , takes 8,5 sec.
i've try same insert operations straight in mysql cmd (using hardcoded "insert strings" in procedure) , shows me time - 0,85 sec. such result me slow, problem of mysql
reading forum have found post says spring data jpa can't bulk insert properly.
how can make app more faster? want use bulk insert operations size 1000 or more.
the situation complicated fact can't store object db in 1 bulk (despite size of bulk)
to make clearer:
the objectgame contains list of objectround objectgame contains list of objectgameplayer objectround contains list of objectroundcard objectgameplayer contains list of objectplayercard objectgameplayer contains list of objectplayerbet
of course, insert objectgame needs make several steps: insert bulk of objectgame , ids having objectgame's ids insert bulk of objectround , ids ... , on
which way more appropriate me?
using spring data jpa, jdbc, hibernate, mybatis? or way ?
Comments
Post a Comment