Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Data JPA saveAll not doing batch insert

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

like image 582
UnguruBulan Avatar asked Jan 25 '23 14:01

UnguruBulan


1 Answers

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

like image 87
Cepr0 Avatar answered Jan 28 '23 04:01

Cepr0