如何使用Springboot数据JPA和Mysql进行批量插入/更新

如何使用Springboot数据JPA和Mysql进行批量插入/更新,mysql,spring-boot,spring-data-jpa,Mysql,Spring Boot,Spring Data Jpa,我试图用SpringBoot数据和Mysql实现批插入/更新记录, 这是我的yml配置: spring.jpa.properties.hibernate.show_sql=true spring.jpa.properties.hibernate.order_inserts=true spring.jpa.properties.hibernate.order_updates=true spring.jpa.properties.hibernate.jdbc.batch_size=500 sprin

我试图用SpringBoot数据和Mysql实现批插入/更新记录, 这是我的yml配置:

spring.jpa.properties.hibernate.show_sql=true
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.jdbc.batch_size=500
spring.jpa.properties.hibernate.jdbc.batch_versioned_data=true
spring.jpa.properties.hibernate.generate_statistics=true
这里,我使用一个mysql自动增量列作为主键

public class Customer implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
}
我在谷歌上搜索到批处理操作不能与GenerationType.IDENTITY一起工作, 但我也注意到mysql不支持GenerationType.SEQUENCE 那么,我如何使用jpa的saveAll(data)方法和mysql数据库完成巴斯插入/更新呢

多谢各位

我在谷歌上搜索到批处理操作不能与GenerationType.IDENTITY一起工作,但我注意到mysql不支持GenerationType.SEQUENCE


在应用程序中设置id。例如,出于某种原因,我更喜欢使用db自动递增主键(GenerationType.IDENTITY),而不是UUID。有什么解决办法吗?