以前在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. 集合框架-LinkedList集合(有序不唯一)

    1 package cn.itcast.p2.linkedlist.demo; 2 3 import java.util.Iterator; 4 import java.util.LinkedList ...

  2. ambari-hadoop集群管理web工具

    https://baike.baidu.com/item/Ambari/19697889?fr=aladdin https://www.ibm.com/developerworks/cn/openso ...

  3. linux中awk命令(最全面秒懂)

    目录 一:linux中awk命令 1.awk命令简介 2.awk作用 3.awk的语法格式 4.解析awk使用方法 5.参数 6.awk的生命周期 二:awk中的预定义变量 三:awk运行处理规则的执 ...

  4. URL跳转空白页参数传递封装

    这东西主要是为了vue和平时打开一个空白界面_blank时的参数传递,不涉及到浏览器存储(session,local等) 众所周知,请求传参无非就用的query和params,相对应就是get和pos ...

  5. socket在php作用

    PHP 使用Berkley的socket库来创建它的连接.你可以知道socket只不过是一个数据结构.你使用这个socket数据结构去开始一个客户端和服务器之间的会话.这个服务器是一直在监听准备产生一 ...

  6. 【论文总结】Zero-Shot Semantic Segmentation

    论文地址:https://arxiv.org/abs/1906.00817 代码:https://github.com/valeoai/ZS3 一.内容 Step 0:首先使用数据集(完全不包含 Un ...

  7. 《PHP程序员面试笔试宝典》——如何回答非技术性问题?

    如何巧妙地回答面试官的问题? 本文摘自<PHP程序员面试笔试宝典> 评价一个人的能力,除了专业能力,还有一些非专业能力,如智力.沟通能力和反应能力等,所以在IT企业招聘过程的笔试.面试环节 ...

  8. Solution -「多校联训」查拉图斯特拉如是说

    \(\mathcal{Description}\)   Link.   给定 \(n\) 和 \(m\) 次多项式 \(f(x)\),求 \[\sum_{i=0}^n\binom{n}{i}f(i)\ ...

  9. VSCode官方的配置同步方案

    前言 这几天在迁移电脑工作环境,对于VSCode,我实在不想从头做下载插件.配置代码规则这样的事情,于是求助百度,搜索结果靠前的解决方案基本都是使用Setings Sync插件,于是我就从了. 经过好 ...

  10. Java基于ClassLoder/ InputStream 配合读取配置文件

    阅读java开源框架源码或者自己开发系统时配置文件是一个不能忽略的,在阅读开源代码的过程中尝尝困惑配置文件是如何被读取到内存中的.配置文件本身只是为系统运行提供参数的支持,个人阅读源码时重点不大可能放 ...