Batch size must be set, and inserts must be ordered, before Hibernate groups statements.
// application.yml
spring:
jpa:
properties:
hibernate:
jdbc.batch_size: 50
order_inserts: true
order_updates: true
batch_versioned_data: true
Without order_inserts, an interleaved insert order breaks each batch
after one statement, and the batch size has no effect at all.
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-08-11