【发布时间】:2017-09-04 15:23:02
【问题描述】:
我有一个带有 application.yml 的 Spring Boot 应用程序:
spring:
datasource:
driver-class-name: org.postgresql.Driver
url: *my_url*
password: *my_pass*
username: *my_username*
jpa:
properties:
hibernate:
jdbc:
batch_size: 15
#order_inserts: true
#order_updates: true
#batch_versioned_data: true
当我尝试使用 saveAll(Iterable<S> entities) 方法保存 200 000 个实体时,它会同时保存所有 200 000 个实体,但我想一次保存 15 个实体的批次。
是否可以使用Spring Data的SimpleJpaRepository和Hibernate的批处理?
【问题讨论】:
-
你使用的是哪个版本的Spring数据?
-
@Cepr0,那个链接是不是有点老了?
-
@11thdimension 我认为没有)google.com.ua/search?q=batch+insert+in+spring+data+jpa
-
@Cepr0 这是 5 年前,一个家伙正在使用 Session 来管理事务。它很旧。
标签: java hibernate spring-data