以前在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. k8s 基于RBAC的认证、授权介绍和实践

    在K8S中,当我们试图通过API与集群资源交互时,必定经过集群资源管理对象入口kube-apiserver.显然不是随随便便来一个请求它都欢迎的,每个请求都需要经过合规检查,包括Authenticat ...

  2. golang中内存地址计算-根据内存地址获取下一个内存地址对应的值

    package main import ( "fmt" "unsafe" ) func main() { // 根据内存地址获取下一个字节内存地址对应的值 da ...

  3. 函数的参数python教程

    一:函数 什么是函数? 函数就类似于工具 提前定义之后可以反复使用 代码冗余 结构清晰 修改繁杂等问题 二:函数的语法结构 def 函数名(参数1,参数2) '''函数注释''' 函数体代码 retu ...

  4. windows系统配置Nginx使用SSL证书实现Https反向代理

    Nginx反向代理服务,可以代理接收请求,并把请求转发到设置好的其他服务器上. 例如,Nginx服务器为 100.101.102.103,A服务为 100.101.102.104 ,通过Nginx配置 ...

  5. py笔记第一篇

    #!/usr/bin/python #coding=utf-8 #@rename file #@2019/11/27 import os ls = os.rename('/root/tigergao. ...

  6. linux可用内存判断

    free是完全没有占用的空闲内存,Available 减 free是操作系统为了优化运行速度拿来调用的内存, 程序需要的话操作系统会进行释放.所以一般看Available即可. free+buffer ...

  7. Ventoy的UEFI模式安全启动操作说明

    Ventoy 1.0.07 版本开始支持 Secure Boot (安全启动),但是这个方案不是非常的完美,会导致在一些机器上不管BIOS里安全启动是否关闭都不能正常工作.因此从 1.0.09 版本开 ...

  8. Elasticsearch(2) 数据搜索

    本文介绍如何在Elasticsearch中对数据进行搜索. 1.简述 在Elasticsearch中的搜索中,有两类搜索: queries aggregations 区别在于:query可以进行全文搜 ...

  9. Lesson4——NumPy 数组属性

    NumPy 教程目录 NumPy 数组的维数称为秩(rank),秩就是轴的数量,即数组的维度,一维数组的秩为 1,二维数组的秩为 2,以此类推. 在 NumPy中,每一个线性的数组称为是一个轴(axi ...

  10. TCP连接的状态转换图深度剖析

    转载请注明来源:https://www.cnblogs.com/hookjc/ 在TCP/IP协议中,TCP协议提供可靠的连接服务,采用三次握手建立一个连接,如图1所示. (1)第一次握手:建立连接时 ...