Spring Data JPA saveAll/Save method as batch insert

Viewed 596

I have noticed the behaviour of the save method performing the insert as a batch when setting spring.jpa.properties.hibernate.order_inserts=true. The saveAll is indeed doing the batch insert. But what I found strange is that the save method is doing batch as well. Is that normal?

Thanks.

1 Answers

Yes, that is normal. In the end, batching is a Hibernate feature and Spring just calls persist/merge on the EntityManager. Hibernate figures out behind the scenes how it can do batching.

Related