【发布时间】:2020-09-10 02:29:11
【问题描述】:
我正在尝试使用 CrudRespositories saveAll 方法进行批量/批量更新,但它似乎不起作用。生成日志:
2020-05-23 07:06:27.963Z INFO [nio-8080-exec-1] i.StatisticalLoggingSessionEventListener {} : Session Metrics {
314694800 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
54054998 nanoseconds spent preparing 12 JDBC statements;
5762126698 nanoseconds spent executing 12 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
我认为0 JDBC batches 表示尚未完成批量更新?
我为批处理配置了以下属性:
spring.jpa.properties.hibernate.jdbc.batch_size=30
spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.batch_versioned_data=true
依赖版本:
Spring boot : 2.2.5.RELEASE
Oracle : tried on both 11g and 12c
jdbc driver :
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>18.3</version>
让我知道还需要做什么才能使其正常工作?如果提供这些属性不起作用,还有其他可能的解决方案吗?
【问题讨论】:
标签: hibernate spring-boot spring-data