异常: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,而没有去判断是否为空字符串. ...
随机推荐
- Linux帮助都有哪几种,如何使用?
帮助文件有2类,内置命令和外部命令. 其中内置命令就是shell内核自带的,因为shell当中自己要进行管理,那么就需要一些命令进行管理,不同的shell肯定有不同的shell命令,我们用type命令 ...
- 18式优雅你的Python
本文来自读者梁云同学的投稿,公众号:Python与算法之美 一,优雅你的Jupyter 1,更改Jupyter Notebook初始工作路径 平凡方法: 在cmd中输入jupyter notebook ...
- 6 Django的视图层
视图函数 一个视图函数,简称视图,是一个简单的Python 函数,它接受Web请求并且返回Web响应.响应可以是一张网页的HTML内容,一个重定向,一个404错误,一个XML文档,或者一张图片. . ...
- mysql 中的基本用法,以及日期的转换
1.mysql int(10) int 类型长度4个字节,大约表示2^32数字,10代表的是显示长度,一般和FILLZERO约束一起使用,如果没有达到该长度,填充02-->000000002 m ...
- Maven学习 (二) Eclipse 上安装 Maven3插件
eclipse 安装插件的方式最常见的有两种: 1. 一种是在线安装,这貌似是用的最多的,就是:Help --> Install New Software,然后输入 HTTP 地址来安装,但 ...
- Eclipse 创建 Java 类---Eclipse教程第10课
打开新建 Java 类向导 你可以使用新建 Java 类向导来创建 Java 类,可以通过以下途径打开 Java 类向导: 点击 "File" 菜单并选择 New > Cla ...
- 用CSS伪元素制作箭头
现在让我们开始制作箭头吧! 在开始前,你要知道如何用CSS去画一个三角形,如果还不清楚可以看看这里纯CSS画各种图形 我们用到两个CSS伪元素,before和after,它们属于行内元素,但可以用di ...
- C:\Windows\System32目录可执行文件列表(Win7 64)
C:\Windows\System32>where /? C:\Windows\System32>where "c:\windows\system32:*.exe" & ...
- Python全栈工程师(编码)
ParisGabriel Python 入门基础 补充: 主流3操作大系统 Windows: Winxp Win7 Win8 Win10 Unix: Solaris(SUN) IO ...
- ssh-debian87.sh
#!/bin/bash sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config s ...