异常:Batch update returned unexpected row count from update [0]; actual row count: 0;
使用了hibernate的主键生成策略,而在程序中又主动去设置了主键值。<class name="ProductRegion" table="PRODUCT_REGION" lazy="false">
<id name="id" column="PRODUCT_REGION_ID">
<generator class="native" />
</id>
<many-to-one class = "gira.domain.place.Region" name="region" column="PRODUCT_REGION_REGION_ID" />
<many-to-one class = "Product" name="product" column="PRODUCT_REGION_PRODUCT_ID" ></many-to-one>
<property name="index" column="PRODUCT_REGION_INDEX" />
</class>
程序中:
for(Long l:regionIds){
Region region=regionDao.findById(l);
ProductRegion productRegion=new ProductRegion();
productRegion.setProduct(product);
productRegion.setRegion(region);
productRegion.setId(i);
i++;
productRegions.add(productRegion);
}
从而出现异常了
异常:Batch update returned unexpected row count from update [0]; actual row count: 0;的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 关于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 ...
- Nhibernate Batch update returned unexpected row count from update; actual row count: 0 解决方案
以前在session.Update(object).没发现啥问题,最近update的时候,老是报错:Nhibernate Batch update returned unexpected row co ...
- 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,而没有去判断是否为空字符串. ...
随机推荐
- 路由器基础配置之rip
我们将以上面的拓扑图进行实验,用rip协议来进行实验,目的是实现三台不同网段的pc机之间实现互相通信 首先为pc机配置好ip地址和网关,配置完IP地址后在配置路由器 router1: enable 进 ...
- 谷歌浏览器如何调试JS
平常在开发过程中,经常会接触到前端页面.那么对于js的调试那可是家常便饭,谷歌浏览器是常用来调试JS代码的工具,本文主要介绍如何利用谷歌浏览器来调试JS代码,协助我们进行开发工作,加快开发效率. 1. ...
- tcl之string操作-length/index/range/replace
- google云函数实现BigQuery数据操作
Google Cloud Function操作BigQuery数据库. 1.部署云函数时在配置文件中(package.json)添加一项 "@google-cloud/bigquery&qu ...
- yii2 url 美化参数
所谓的url参数美化就是将冗长的字符串 进行正则替换 yii2 框架的url参数美化完成需要完成两个阶段 第一个阶段分apache和nginx 两种的配置 apache :1.1 必须开启rewrit ...
- C语言指针篇(一)指针与指针变量
指针 1. 什么是指针? 2. 指针可不可怕? 3. 指针好不好玩? 4. 怎么学好指针? C语言是跟内存打交道的语言,指针就是内存地址.指针无处不在,指针并不可怕,相反,等你学到一定程 ...
- python模块struct和subprocess
准确地讲,Python没有专门处理字节的数据类型.但由于str既是字符串,又可以表示字节,所以,字节数组=str.而在C语言中,我们可以很方便地用struct.union来处理字节,以及字节和int, ...
- 内存释放free函数的异常问题
本次在实际应用中遇到一个问题,首先是定义了一个指针,然后这个指针指向某一个地址,但是这个地址不是用malloc分配的.如果后面用free去释放这个指针会产生什么现象. 首先看下指针的声明和使用 uin ...
- 底部菜单栏之Fragment的详细介绍和使用方法
详情请看:http://blog.csdn.net/loongggdroid/article/details/9366413
- USACO Section2.3 Longest Prefix 解题报告 【icedream61】
prefix解题报告------------------------------------------------------------------------------------------ ...