问题描述:
用jpa删除数据库记录报错:
org.springframework.orm.jpa.JpaSystemException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1; nested exception is org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1
Caused by: org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1
修改前代码:
Dao层:
@Repository
public interface FtFileInfoDAO extends JpaRepository<FtFileInfoDO, BigInteger> {
List<FtFileInfoDO> findAllByDataId(Long dataId);
@Transactional
Long deleteByDataId(Long dataId);
}
Entity层:
@Entity
@Table(name = "ft_file_info&