gpt4 book ai didi

java - Spring Data JPA saveAll 不执行批量插入

转载 作者:行者123 更新时间:2023-12-02 01:13:34 28 4
gpt4 key购买 nike

所以我使用一个简单的 JpaRepository 并调用 saveAll() 方法。

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

运行应用程序后:

   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)

任何人都可以看到 0 执行 JDBC 批处理的原因吗?另外,我必须指出我的实体具有 @GenerateValue(strategy = IDENTITY) 主键

最佳答案

Hibernate 不会使用身份标识符生成器执行插入批处理。更多信息为here .

关于java - Spring Data JPA saveAll 不执行批量插入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59002107/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com