在操作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的更多相关文章

  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 ...

  2. 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 ...

  3. Batch update returned unexpected row count from update [0] 异常处理

    在one-to-many时遇到此异常,本以为是配置出错.在使用s标签开启debug模式,并在struts2主配置文件中添加异常映射,再次提交表单后得到以下异常详情. org.springframewo ...

  4. 关于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 ...

  5. 关于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 ...

  6. 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 ...

  7. Nhibernate Batch update returned unexpected row count from update; actual row count: 0 解决方案

    以前在session.Update(object).没发现啥问题,最近update的时候,老是报错:Nhibernate Batch update returned unexpected row co ...

  8. 错误Batch update returned unexpected row count from update [0]; actual row count: 0;

    参考:http://blog.csdn.net/ssyan/article/details/7471343 也是出现类似问题,在前台页面的隐藏域中判断id是否为null,而没有去判断是否为空字符串. ...

  9. hibernate 解决 org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

    这是因为没有设置要更新的主键导致的,只要设置了要更新的主键就能更新成功(没有主键当然不能更新)

随机推荐

  1. 【JavaScript】之函数的this

    提起函数中的this是很多初学者较为苦恼的,也是很多工作一段时间的人也存在误解的,你问this指向的是谁,大多数人会随口一答当然是指向调用这个函数的元素,当然这也没什么错,可是函数的调用方法不同thi ...

  2. avd manager或sdk manager无法打开

    最近开始搞安卓,使用AS启动项目时老是报各种错误,而网上这方面的资料很多都解决不了.只能边实验边做. 定位到avd manager或sdk manager无法打开,网上找了很多资料,都不能解决,知道看 ...

  3. IDEA安装使用

    下载地址: https://www.jetbrains.com/idea/download/previous.html 这里我下载的是:2016.3.8版本的 安装: 安装成功后,需要秘钥的话,在 h ...

  4. hibernate对象状态 的小问题

    Class classA{ List a; public void setA(List a) { this.a =a; } public List getA() { return this.a; } ...

  5. 博客之旅 gogogo!

    听说写博客的人都很牛~ 上班一年多了,想记录点什么,so,就写博客吧,整理一些技术点与工作生活心得 欢迎各位道友交流学习 :)

  6. jQuery 首页搜索区域模块随页面滑动而变化

    /*搜索区块的颜色变化*/ function search(){ var searchBox = document.querySelector('.m_head'); var bannerBox = ...

  7. ztree 展开一级节点 | ztree只显示到二级目录

    // 默认展开一级节点var nodes = tree.getNodesByParam("level", 0);for (var i = 0; i < nodes.lengt ...

  8. dxf组码

    值 说明 -5 APP:永久反应器链 -4 APP:条件运算符(仅与 ssget 一起使用) -3 APP:扩展数据 (XDATA) 标记(固定) -2 APP:图元名参照(固定) -1 APP:图元 ...

  9. CAD使用GetxDataDouble读数据(com接口)

    主要用到函数说明: MxDrawEntity::GetxDataDouble2 读取一个Double扩展数据,详细说明如下: 参数 说明 [in] LONG lItem 该值所在位置 [out, re ...

  10. BZOJ4318: OSU! (概率DP)

    题意:一个串 给出每个字符为1的可能性 否则为0 一段连续的1能获得长度的立方的收益 问总收益的期望 题解:设x_i为到第i位时连续的1的期望长度 由i-1递推来的贡献 如果这一位是0没有贡献 如果是 ...