首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > PowerDesigner >

Batch update returned unexpected row count from update [零]; actual row count

2012-09-02 
Batch update returned unexpected row count from update [0] actual row count异常:Batch update retur

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

原因:
     这个异常是由于主键设置为自增长,而在我们插入记录的时候设置了ID的值导致的。

解决方案:
     我在页面上写了子表ID的隐藏表单域,传到后面的时候value="" ,不是value=null,所以执行的时候hibernate判断为更新,因此报错。我的解决方案是把ID传到后台,然后用代码判断是否为空,然后进行更新或者增加。

if ("".equals(dsTaskId)) {dsTaskId = null;}

热点排行