Spring Boot JPA Bulk insert

前端 未结 1 1688
青春惊慌失措
青春惊慌失措 2021-01-19 13:57

I have 3 Entities Parent,Child,SubChild. Parent is a parent of Child and Child is a parent of SubChild. I need to insert around 700 objects of Parent. Parent can have 50 Obj

相关标签:
1条回答
  • 2021-01-19 14:34

    To enable batch insert you need the batch_size property which you have in your configuration.

    Also since a jdbc batch can target one table only you need the spring.jpa.hibernate.order_inserts=true property to order the insert between parent and child or else the statement are unordered and you will see a partial batch (new batch anytime an insert in a different table is called)

    0 讨论(0)
提交回复
热议问题