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
浙公网安备 33010602011771号