以前在session.Update(object)。没发现啥问题,最近update的时候,老是报错:Nhibernate Batch update returned unexpected row count from update; actual row count: 0 ;后来发现这个是因为nhibernate一级缓存机制引起的,所以我们要这么做就没啥问题了。

session.Clear();

session.Update();

session.Flush();

这三个东西,session.Clear() 是把一级缓存里面的东西清除掉(保留session) session.Flush(让缓存和数据库当中做到一致)

Nhibernate Batch update returned unexpected row count from update; actual row count: 0 解决方案的更多相关文章

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

  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. 高度塌陷与 BFC

    1. 高度塌陷 在浮动布局中,父元素的高度默认是被子元素撑开的  当子元素浮动后,其会完全脱离文档流,子元素从文档流中脱离将会无法撑起父元素的高度,导致父元素的高度丢失  父元素高度丢失以后,其下的元 ...

  2. python网络爬虫-动态网页抓取(五)

    动态抓取的实例 在开始爬虫之前,我们需要了解一下Ajax(异步请求).它的价值在于在与后台进行少量的数据交换就可以使网页实现异步更新. 如果使用Ajax加载的动态网页抓取,有两种方法: 通过浏览器审查 ...

  3. Vue之JavaScript基础(闭包与原型链)

    闭包 定义:能够访问另一个函数作用域的变量的函数. 作用:可以通过闭包,设计私有变量及方法 实例: function outer() { var a = '变量1' var inner = funct ...

  4. dubbo框架的使用方法。。。

    图解. 一.dubbo使用须知. 1.所有的service层必须要使用service注解(之前用的spring框架的,现在用dubbo框架所提供的@Service注解) // @Service(tim ...

  5. 「JOISC 2016 Day 1」棋盘游戏

    「JOISC 2016 Day 1」棋盘游戏 先判无解:第1,3行有连续的空格或四个角有空格. 然后可以发现有解的情况第1,3行可以在任意时间摆放. 对于某一列,若第2行放有棋子,那么显然可以把棋盘分 ...

  6. Linux shell脚本之 if条件判断 (转)

    IF条件判断 1.基本语法: if [ command ]; then 符合该条件执行的语句 fi 2.扩展语法: if [ command ];then 符合该条件执行的语句 elif [ comm ...

  7. Java与网页JSP文件编码的小总结

    感谢大佬: https://www.cnblogs.com/yangguoe/p/8467672.html(编码发展史) https://blog.csdn.net/seabiscuityj/arti ...

  8. Shell for&while中的循环

    #!/usr/bin/ksh #数字段形式 for i in {1..10} do echo $i done #详细列出(字符且项数不多) for File in 1 2 3 4 5 do echo ...

  9. Centos 系统目录概述

    Linux目录一切从根目录开始,即"/",根下面的目录是一个有层次的树状结构.并且分区或磁盘是必须挂载在根目录才可以正常访问.做一个形象的比喻:目录类似一个一个的入口,而根目录则是 ...

  10. 【HDU6662】Acesrc and Travel(树型Dp)

    题目链接 大意 给出一颗树,每个点上有一个权值\(A[i]\),有两个绝顶聪明的人甲和乙. 甲乙两人一起在树上轮流走,不能走之前经过的点.(甲乙时刻在一起) 甲先手,并可以确定起点.甲想要走过的点权之 ...