ERROR - Exception executing batch: 
org.hibernate.StaleStateException: Batch update returned unexpected row count fr
om update [0]; actual row count: 0; expected: 1

ERROR - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count fr
om update [0]; actual row count: 0; expected: 1

不注意的话,还真的有点无所适从,Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
这个异常是由于主键设置为自增长,而在我们插入记录的时候设置了ID的值导致的。看下我的Hibernate映射文件中ID的定义:

异常积累:org.hibernate.StaleStateException的更多相关文章

  1. 在Hibernate单向一对多关联关系中的org.hibernate.StaleStateException 异常。

    具体异常如下: Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count fro ...

  2. 关于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 ...

  3. 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 ...

  4. 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 ...

  5. hibernate异常:org.hibernate.exception.GenericJDBCException

    异常:org.hibernate.exception.GenericJDBCException 提示:Cannot open connection 提示:不能打开链接 一般这个异常是由 java.sq ...

  6. hibernate异常:org.hibernate.MappingException

    这个是映射文件配置错误 异常:org.hibernate.MappingException 提示:Could not determine type for: java.lang,String, at ...

  7. hibernate异常:org.hibernate.NonUniqueObjectException

    异常:org.hibernate.NonUniqueObjectException 提示:a different object with the same identifier value was a ...

  8. 错误/异常:org.hibernate.MappingException: Unknown entity: com.shore.entity.Student 的解决方法

    1.错误/异常视图 错误/异常描述:Hibernate配置文件 映射异常,不明实体类Student(org.hibernate.MappingException: Unknown entity: co ...

  9. 懒加载异常:org.hibernate.LazyInitializationException: could not initialize proxy - no Session

    病症:这是一个lazy使用后的Exception,使用迟时加载,在session(hibernate里的session),关闭后使用该对象的未加载变量,也就是说session已经关闭,没有保存到内存中 ...

随机推荐

  1. MySQL解压版安装配置

    官网下载地址:http://dev.mysql.com/downloads/windows/installer/ (可以选择解压版zip下载,也可以选择msi安装版.) 解压zip版配置: 1. 下载 ...

  2. cordova插件iOS平台实战开发注意点

    cordova插件是其设计理念的精髓部分,创建并使用自定义插件也是一件比较容易的事.但在这个过程中也容易进入一些误区或者有一些错误的理解,下面从笔者实际开发中遇到的问题出发,对其中的一些注意点和重要概 ...

  3. 在大数据中,关于native包的编译步骤

    一.问题的由来: 二.解决问题的方法(所有的操作在root下完成): 1.前期需要的环境,下面的已经在伪分布式中配置好,不再重复 配置好jdk 配置好hadoop 2.上传还需要包 apache-ma ...

  4. C# 判断字符串是否为日期格式

    判断字符串内容是否为日期格式,并返回一个日期变量 string str; DateTime dtTime; if (DateTime.TryParse(str, out dtTime)) { //st ...

  5. linux下连接本地的navicate

    1.进mysql cd mysql; cd bin; ./mysql -uroot -proot; show databases;#可以没有 #修改权限 1.GRANT ALL PRIVILEGES ...

  6. 探讨mvc下linq多表查询使用viewModel的问题

    最近在开发mvc3的时候发现了一个问题,就是如何在view页面显示多表查询的数据,最简单的办法就是使用viewmodel了,以下本人使用viewmodel来实现多表查询的3中方法, 先贴代码再说: 1 ...

  7. Dynamics AX Read OLEDB

    static System.Data.DataTable getOLEDB_Record(str _dbPath,str _query) { System.Data.OleDb.OleDbConnec ...

  8. CodeMIrror 简单使用

    代码高亮是程序员的刚需,不管是在笔记类,论坛类,博客类web网站中,都对代码高亮提出要求,不高亮的代码阅读体验很差,codeMirror是一个前端代码高亮库,使用方便. codeMirror可以直接在 ...

  9. SQL学习笔记 SQL ORDER BY 关键字

    SELECT column_name,column_nameFROM table_nameORDER BY column_name,column_name ASC|DESC; SELECT id, n ...

  10. 我的工具箱之VNC

    下载地址:http://pan.baidu.com/s/1bovEoZ9 这个工具可以连接到Linux并进行可视化操作. 如何搭建VNC环境请见 在centOS上安装VNC 2016年2月26日11: ...