hibernate Row was updated or deleted by another transaction

来源:互联网 发布:ensp交换机端口 编辑:程序博客网 时间:2024/06/06 04:58
 

在开发免费ERP 2BizBox 的过程中,更新一个员工的时候,hibernate出现了如下错误:

 

Row was updated or deleted by another transaction 。

 

最后通过排查是由于用于记录数据版本的字段version 为NULL,正常使用不可能为NULL,可能是由于直接操作数据库造成的, 通过如下语句,把NULL 改成0,OK了。

update employee set version = 0 where version is NULL;