Skip to content
Advertisement

JPA batch_size property does not work for native query

I’m trying to make a bulk insert with a native query.

I’ve added batch_size property to the application.properties file

But in the logs, I see that every insert processed separately. Is it possible to apply batching to native query?

Advertisement

Answer

If the entities use GenerationType.IDENTITY identifier generator, hibernate will silently disable batch inserts/updates.

Please find the following link for the details: https://www.baeldung.com/jpa-hibernate-batch-insert-update#id-generation-strategy

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement