ashley
ashley

Reputation: 1038

Spring Data JPA saveAll/Save method as batch insert

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.

Upvotes: 4

Views: 2781

Answers (1)

Christian Beikov
Christian Beikov

Reputation: 16400

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.

Upvotes: 2

Related Questions