Nhibernate Batch update returned unexpected row count from update; actual row count: 0 解决方案
以前在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 解决方案的更多相关文章
- 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 ...
- 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 ...
- 错误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
这是因为没有设置要更新的主键导致的,只要设置了要更新的主键就能更新成功(没有主键当然不能更新)
随机推荐
- 【webpack4.0】---webpack的基本使用(一)
一.初识webpack 1.什么是webpack? WebPack可以看做是模块打包机:它做的事情是,分析你的项目结构,找到JavaScript模块以及其它的一些浏览器不能直接运行的拓展语言(Scss ...
- linux虚拟机快照
目录 一:虚拟机快照 一:虚拟机快照 1.什么是快照? 快照可保存虚拟机在特定时刻的状态和数据. 状态包括虚拟机的电源状态(列如,打开电源,关闭电源,挂起). 数据包括组成虚拟机的所有文件,这包括磁盘 ...
- 最长公共子序列-LIS
题目描述 时间限制:1.0s 内存限制:256.0MB 问题描述 给定一个长为\(n\)的序列,求它的最长上升子序列的长度. 输入格式 输入第一行包含一个整数\(n\). 第二行包含\(n\)个整数\ ...
- kicad6 封装库的管理
kicad6 封装库的管理 kicad6 的封装编辑器有很多莫名其妙的地方, 让人在第一次用的时候摸不着头脑. 在下面稍微总结一下封装库的操作 1. 封装库的创建 选择 文件 -> 新建库 有两 ...
- JVM学习十一 - (复习)性能调优
在高性能硬件上部署程序,目前主要有两种方式: 通过 64 位 JDK 来使用大内存: 使用若干个 32 位虚拟机建立逻辑集群来利用硬件资源. 使用 64 位 JDK 管理大内存 堆内存变大后,虽然垃圾 ...
- spring 事务的传播级别和隔离级别
1.事务的传播级别 1)@Transactional(propagation=Propagation.REQUIRED):默认的spring事务传播级别,使用该级别的特点是,如果上下文中已经存在事务, ...
- Redis性能管理
Redis性能管理 目录 Redis性能管理 一.查看Redis内存使用 二.内存碎片率 三.内存使用率 四.避免内存交换发生的方法 1. Hash数据类型 1.1 HSET/HGET/HDEL/HE ...
- 详解Java12新增语法switch表达式
引言 在学习分支语句的时候,我们都学过 switch 语句,相比于 if-else 语句,他看起来更加整洁,逻辑更加清晰,Java中当然也给我们提了相关的 switch 方法.但是Java的强大之处在 ...
- python基础语法_9-2函数式编程
https://www.imooc.com/learn/317 大纲 1-函数式编程简介 2-高阶函数 3-把函数作为参数 4-map()函数 5-reduce()函数 6-filter()函数 7- ...
- netty系列之:不用怀疑,netty中的ByteBuf就是比JAVA中的好用
目录 简介 ByteBuf和ByteBuffer的可扩展性 不同的使用方法 性能上的不同 总结 简介 netty作为一个优秀的的NIO框架,被广泛应用于各种服务器和框架中.同样是NIO,netty所依 ...