JPA(Hibernate)批量插入不起作用

Batching not working even after configuring the properties

The most probable reason is that you are using GenerationType.IDENTITY identifier generator.

It is important to realize that using IDENTITY columns imposes a runtime behavior where the entity row must be physically inserted prior to the identifier value being known. Due to this limitation, Hibernate will not be able to batch INSERT statements for the entities using the IDENTITY generation.

Using GenerationType.SEQUENCE is the recommended approach in batch processing.

 

https://howtodoinjava.com/hibernate/batch-processing/

https://dzone.com/articles/spring-boot-boost-jpa-bulk-insert-performance-by-100x

posted on 2023-07-25 13:46  jmbkeyes  阅读(140)  评论(0)    收藏  举报

导航