Spring Data JPA saveAll not doing batch insert

UnguruBulan :

So I'm using a simple JpaRepository and the saveAll() method is called.

hibernate.jdbc.batch_size = 500
hibernate.order_inserts = true
hibernate.generate_statistics = true

After running the application:

   8045055 nanoseconds spent acquiring 1 JDBC connections;
    0 nanoseconds spent releasing 0 JDBC connections;
    137189246 nanoseconds spent preparing 1158 JDBC statements;
    1417689514 nanoseconds spent executing 1158 JDBC statements;
    0 nanoseconds spent executing 0 JDBC batches;
    0 nanoseconds spent performing 0 L2C puts;
    0 nanoseconds spent performing 0 L2C hits;
    0 nanoseconds spent performing 0 L2C misses;
    16270990 nanoseconds spent executing 1 flushes (flushing a total of 1158 entities and 0 collections);
    0 nanoseconds spent executing 0 partial-flushes (flushing a total of 0 entities and 0 collections)

Can anyone see a reason for 0 having JDBC batches executed? Also, I have to point that my entity has @GeneratedValue(strategy = IDENTITY) primary key

Cepr0 :

Hibernate doesn't perform insert batching with the identity identifier generator. More info is here.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Spring Batch JPA SaveALL() and SAVE() not working and no Error

Spring Data JPA: Batch insert for nested entities

Does JPA saveall method uses hibernate batch to update/insert

Spring Batch/Data JPA application not persisting/saving data to Postgres database when calling JPA repository (save, saveAll) methods

how to configure spring boot and data jpa for batch insert

Spring Data JPA batch insert or update doesn't work

Spring JPA: Insert data in a @JoinTable

CannotCreateTransactionException in Spring Data JPA batch process

Spring Data Jpa Repository findBy Part of Data not by doing all cases

JPA saveAll forces UPDATE call after INSERT INTO on OneToMany

Spring data save vs saveAll performance

Spring data MongoDB - Insert batch skip duplicates

spring data jpa: Insert instead of delete

what did not insert db by spring data jpa

Spring Boot Data JPA doing lazy loading - not on a relation but on the loaded entity?

How to avoid Spring Data Jpa doing join on simple select?

Related entities are null after calling saveAll in Spring JPA

Spring boot - Jpa - SaveAll(Entity <S>) missing entities in the database

Spring Data Jpa repository in spring batch tasklet throws TransactionRequiredException

Spring Data JPA not saving to database when using Spring Batch

Unable to insert rows in database using Spring Batch + Spring data

Bulk insert with Spring Boot and Spring Data JPA not working

Jpa reader Spring Batch

unable insert data into two tables using spring data jpa

JPA batch insert causing ConstraintViolationException

JPA/Hibernate bulk(batch) insert

How to implement batch update using Spring Data Jpa?

Java Spring JPA insert into

In Spring Batch, can I insert data in a beforeStep implementation