[英]org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException
When running the getsession.update(data)
getting below error; 运行
getsession.update(data)
以下错误;
org.springframework.orm.hibernate4.HibernateOptimisticLockingFailureException: 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
Please help me resolve the issue. 请帮助我解决问题。
issue is occuring becouse batch update supposed to update atlest one row, but it did not update any row. 发生问题是因为批处理更新应该更新至少一行,但没有更新任何行。 becouse your are trying to update row that row is deleted, so batch update is not updating the row and throwing exception.
因为您正在尝试更新该行,所以该行被删除,因此批量更新不会更新该行并抛出异常。
From documentation: 从文档:
public class StaleStateException extends HibernateException
公共类StaleStateException扩展了HibernateException
Thrown when a version number or timestamp check failed, indicating that the Session contained stale data (when using long transactions with versioning).当版本号或时间戳检查失败时抛出,表明会话包含陈旧数据 (当使用带有版本控制的长事务时)。 Also occurs if we try delete or update a row that does not exist .
如果我们尝试删除或更新不存在的行,也会发生这种情况 。
Note that this exception often indicates that the user failed to specify the correct unsaved-value strategy for a class!请注意,此异常通常表明用户未能为类指定正确的未保存值策略!
So, check: 因此,请检查:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.