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对应的数据,所以出现异常。
Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1的更多相关文章
- org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actua ...
- 20.org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actua ...
- Batch update returned unexpected row count from update [0] 异常处理
在one-to-many时遇到此异常,本以为是配置出错.在使用s标签开启debug模式,并在struts2主配置文件中添加异常映射,再次提交表单后得到以下异常详情. org.springframewo ...
- 关于Hibernate级联更新插入信息时提示主键不为空的问题“org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1 ”
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual ...
- 关于Error during managed flush [Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1]错误
控制台报错: 08:07:09.293 [http-bio-8080-exec-2] ERROR org.hibernate.internal.SessionImpl - HHH000346: Err ...
- Batch update returned unexpected row count from update [0];
Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested ...
- Nhibernate Batch update returned unexpected row count from update; actual row count: 0 解决方案
以前在session.Update(object).没发现啥问题,最近update的时候,老是报错:Nhibernate Batch update returned unexpected row co ...
- 错误Batch update returned unexpected row count from update [0]; actual row count: 0;
参考:http://blog.csdn.net/ssyan/article/details/7471343 也是出现类似问题,在前台页面的隐藏域中判断id是否为null,而没有去判断是否为空字符串. ...
- hibernate 解决 org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
这是因为没有设置要更新的主键导致的,只要设置了要更新的主键就能更新成功(没有主键当然不能更新)
随机推荐
- MIUI类ROM如何正确修改dpi
(以下以MIUI为例) 在miui上,如果通过简单的修改build.prop会导致图标重绘错误,App图标分裂.此时配合一条简单的命令即可实现完美无bug的dpi修改. 1.使用终端模拟器执行su 2 ...
- IE浏览器样式表限制
原文链接:http://caibaojian.com/ie-stylesheet.html 在开发头条上发现的IE浏览器样式限制,算是一个IE浏览器的一个bug吧.主要有4点限制:· IE9及以下单个 ...
- Bootstrap modal使用及点击外部不消失的解决方法
这篇文章主要为大家详细介绍了Bootstrap modal使用及点击外部不消失的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 本文实例为大家分享了Bootstrap modal使用及点击 ...
- 6-Java-C(无穷分数)
题目描述: 无穷的分数,有时会趋向于固定的数字. 请计算[图1.jpg]所示的无穷分数,要求四舍五入,精确到小数点后5位,小数位不足的补0. 请填写该浮点数,不能填写任何多余的内容. 正确算法: 此题 ...
- 几个net命令
A.显示当前工作组服务器列表 net view,当不带选项使用本命令时,它就会显示当前域或网络上的计算机上的列表. 比如:查看这个IP上的共享资源,就可以 C:\\>net view 192 ...
- Android获取屏幕的大小与密度的代码
Android项目开发中很多时候需要获取手机屏幕的宽高以及屏幕密度来进行动态布局,这里总结了三种获取屏幕大小和屏幕密度的方法 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
- CSS——可视化格式模型
CSS的可视化格式模型 CSS中规定每一个元素都有自己的盒子模型(相当一规定了这个元素如何显示): 然后可视化格式模型则是把这些盒子模型按照规则摆放到页面上,也就是如何布局: 换句话说,盒子模型规定了 ...
- hdu 2377 Bus Pass
Bus Pass Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- CSS九宫格样式
CSS .main>div { width: 14%; min-width: 160px; padding: 2%; height: 60px; border: 1px solid #f4f4f ...
- 后端传前端数据乱码(返回json字符串到前端)
中文乱码的问题,在开发过程中难免会遇到,而在配置好编码之后,不管是数据库,还是其他地方都配置好统一UTF-8编码之后,后端从数据库取出数据传回前端,还会乱码,这里以ssm框架为例,因为是我自己遇到的, ...