Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

在操作hibernate数据库时,调用saveOrUpdate方法进行更新保存对象时,

(1)ID为null时执行SAVE,但是前端jsp通过<input type="hidden" name="gwsz.id" value="${gwsz.id }">接收到的为"",不为null,所以出现异常。

(2)ID不为null时执行UPDATE。在保存实例的时候是新增,但你的ID不为null,所以使用的是UPDATE,但是数据库里没有主键相关的值,找不到ID对应的数据,所以出现异常。

 

posted @ 2019-04-04 15:51  littlecarzz  阅读(1390)  评论(0编辑  收藏  举报