ITeye博客

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

east_java · 2009-12-27 13:30 · Hibernate · 企业架构 · Markdown

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

 

这个错误网上都说是

写道

不注意的话,还真的有点无所适从,Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1这个异常是由于主键设置为自增长,而在我们插入记录的时候设置了ID的值导致的

 

更大一点 就是使用了hibernate的主键生成策略,而在程序中又主动去设置了主键值。

 

比如使用了uuid,但在程序中设置了值,或者像网上所说数据库设置自动增长,而程序中设置了值。

 

对于hibernate的更多异常解决方法:

Hibernate 疑难异常及处理

评论(1)

  1. #1 楼 · chenas · 2012-10-06 12:51

    我把数据库里面的第一个字段的id 设置为0,好像这问题及没了

评论功能维护中,当前仅展示历史评论。