Row was updated or deleted by another transaction 异常原因及处理
2017-07-27 13:01
555 查看
org.hibernate.StaleObjectStateException:
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.xx.xx:11]
说明操作的对象时应用了乐观锁机制,或定义pojo时定义了version字段.
错误原因:
当在进行操作时,当前version版本与数据库中version版本不一致;
1:两个以上的session同时对此记录进行了相似操作;
2:数据提交问题:
例如通过编辑页面来修改一条记录时:提交上来的form值对象中version为空或者大于数据库中对应该记录的version字段值,当update时,version不一致就会出错;
解决:
1.用form提交数据时,把version也一并提交上来;
2.从数据库中把version查出来,赋给实体对象;再更新;
Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.xx.xx:11]
说明操作的对象时应用了乐观锁机制,或定义pojo时定义了version字段.
错误原因:
当在进行操作时,当前version版本与数据库中version版本不一致;
1:两个以上的session同时对此记录进行了相似操作;
2:数据提交问题:
例如通过编辑页面来修改一条记录时:提交上来的form值对象中version为空或者大于数据库中对应该记录的version字段值,当update时,version不一致就会出错;
解决:
1.用form提交数据时,把version也一并提交上来;
2.从数据库中把version查出来,赋给实体对象;再更新;
相关文章推荐
- Row was updated or deleted by another transaction 异常原因及处理
- Row was updated or deleted by another transaction 异常原因及处理
- org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsav
- org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorre
- Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
- Row was updated or deleted by another transaction
- hibernate Row was updated or deleted by another transaction
- error:Row was updated or deleted by another transaction
- org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction
- org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsav
- Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
- 使用Hibernate时Row was updated or deleted by another transaction的解决方案
- hibernate异常 org.hibernate.StaleObjectStateException: Row was updated or deleted
- 异常处理:Null value was assigned to a property of primitive type setter of"原因及解决方案
- After delete Trigger throw error:The row value(s) updated or deleted either do not make the row unique or they alter multiple rows (2 rows).
- The row value(s) updated or deleted either do not make the row unique or they alter multiple rows.
- 表删除时 Cannot delete or update a parent row: a foreign key constraint fails 异常处理
- SharePoint, No item exists at It may have been deleted or renamed by another user.
- java:Transaction marked as rollbackOnly异常原因及解决
- Could not obtain transaction-synchronized Session for current thread 异常处理方式