Spring boot 批更新从更新[0]返回了意外的行计数;实际行数:0;应为:在分页和排序存储库中为1

Spring boot 批更新从更新[0]返回了意外的行计数;实际行数:0;应为:在分页和排序存储库中为1,spring-boot,spring-data-jpa,Spring Boot,Spring Data Jpa,我试图使用SpringJpa保存方法插入一些记录,但它给了我以下错误 `2017-04-12 14:06:55.765 INFO 9100 --- [nio-8090-exec-9] o.h.e.j.b.internal.AbstractBatchImpl : HHH000010: On release of batch it still contained JDBC statements 2017-04-12 14:06:55.771 ERROR 9100 --- [nio-8090

我试图使用SpringJpa保存方法插入一些记录,但它给了我以下错误

`2017-04-12 14:06:55.765  INFO 9100 --- [nio-8090-exec-9] o.h.e.j.b.internal.AbstractBatchImpl     : HHH000010: On release of batch it still contained JDBC statements
2017-04-12 14:06:55.771 ERROR 9100 --- [nio-8090-exec-9] o.a.c.c.C.[.[.[/].
[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] 
in context with path [] threw exception [Request processing failed; nested 
exception is 
org.springframework.orm.ObjectOptimisticLockingFailureException: Batch 
update returned unexpected row count from update [0]; actual row count: 0; 
expected: 1; nested exception is org.hibernate.StaleStateException: Batch 
update returned unexpected row count from update [0]; actual row count: 0; 
expected: 1] with root cause

org.hibernate.StaleStateException: Batch update returned unexpected row 
count from update [0]; actual row count: 0; expected: 1
at 


org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:81) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:73) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:63) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final]
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3281) ~[hibernate-core-4.3.7.Final.jar:4.3.7.Final]`
我已在此门户中搜索解决方案,但未获得解决方案

我使用以下代码从我的服务类插入数据

Collection<? extends CcttBulletinProductEntity> lstExistingSerial = ccttBulletinProductJpaRepository
            .findByCompositePrimaryKeyBulletinNumAndCompositePrimaryKeyRevId(
                    productSerial.getBulletinNum(), revId.getRevId() - 1);
    lstExistingSerial.forEach(p -> p.setRevId(null));
    lstExistingSerial.forEach(p -> p.setRevId(revId.getRevId()));
    lstExistingSerial.forEach(p -> p.setLastUpdatedBy(productSerial
            .getLastUpdatedBy()));
    lstExistingSerial.forEach(p -> p.setLastUpdatedDate(productSerial
            .getLastUpdatedDate()));
    for (CcttBulletinProductEntity existingSerial : lstExistingSerial) {
        lstBulletinProducts.add(existingSerial);
    }
    ccttBulletinProductJpaRepository.save(lstBulletinProducts);
收藏
public interface CcttBulletinProductJpaRepository
    extends
    PagingAndSortingRepository<CcttBulletinProductEntity, CcttBulletinProductEntityKey> {

Collection<? extends CcttBulletinProductEntity> findByCompositePrimaryKeyBulletinNumAndCompositePrimaryKeyRevId(
        String bulletinNum, Integer revId);

@Override
public <S extends CcttBulletinProductEntity> Iterable<S> save(
        Iterable<S> entities);