解决org.hibernate.HibernateException: identifier of an instance of com.ahd.entity.Order was altered from2 to 0
错误信息
严重: Servlet.service() for servlet [springmvc] in context with path [/order] threw exception [Request processing failed; nested exception is
org.hibernate.HibernateException: identifier of an instance of com.ahd.entity.Order was altered from 6 to 0] with root cause
org.hibernate.HibernateException: identifier of an instance of com.ahd.entity.Order was altered from 6 to 0
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:85)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
......
出现原因:
1.出现这种错误一般都是因为映射文件中的字段类型和实体类中的元素类型不相同!
eg.
映射文件中id的类型是Integer,也就是int类型的,而实体类中id的类型是long,问题就出现在这里!
2.javabean代码不标准(在写或者修改javabean时一些细节问题没有做好)
eg.

注意:在写或者修改javabean时能用快捷键就用快捷键
解决org.hibernate.HibernateException: identifier of an instance of com.ahd.entity.Order was altered from2 to 0的更多相关文章
- 【hibernate】错误:org.hibernate.HibernateException: identifier of an instance of com.agen.entity.Monthdetail was altered from xx to xx
所报错误: org.hibernate.HibernateException: identifier of an instance of com.agen.entity.Monthdetail was ...
- Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from
Caused by: org.hibernate.HibernateException: identifier of an instance of ... is alterde from Hi ...
- identifier of an instance of xx.entity was altered from xxKey@249e3cb2 to xxKey@74e8f4a3; nested exception is org.hibernate.HibernateException: identifier of an instance of xxentity was altered from错误
用entityManager保存数据时报错如下 identifier of an instance of xx.entity was altered from xxKey@249e3cb2 to xx ...
- Hibernate异常:identifier of an instance of 错误
今天写项目时,在使用hibernate封装的插入方法时,由于需要同时保存多个数据,导致出现identifier of an instance of 如下代码 :(由于最大最小分数不同所以需要插入两条数 ...
- 161117、使用spring声明式事务抛出 identifier of an instance of
今天项目组有成员使用spring声明式事务出现下面异常,这里跟大家分享学习下. 异常信息: org.springframework.orm.hibernate3.HibernateSystemExce ...
- identifier of an instance of com.xxx.model.system.xxxObject was altered from 1765 to 1766
Caused by: org.hibernate.HibernateException: identifier of an instance of com.xxx.model.system.xxxOb ...
- org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance:
详细错误堆栈信息: org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" ...
- 问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found解决方法
问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not fo ...
- spring整合hibernate的时候报异常org.hibernate.HibernateException: createQuery is not valid without active transaction
在整合Spring4+hibernate4时候,当代码执行到dao中CRUD操作时,报了一个异常, org.hibernate.HibernateException: createQuery is n ...
随机推荐
- build.gradle
1.将Eclipse项目导入到Android studio 中 很多点9图出现问题解决方法: 在build.gradle里添加以下两句: aaptOptions.cruncherEnabled = f ...
- 黑群晖DS3617xs-DSM6.1.7up3/up2 开启ROOT用户,同时SATA改eSATA,挂载NTFS硬盘设置(二)
这两天闲来没事在某宝上搞了个黑群晖主机就j1900/4G小主机系统是DCM 6.1.7up3 15284版 网上修改的教程很多,走了好多弯路终于搞定我的黑群NAS,现分享给各位道友,有不足的地方请给位 ...
- java 静态变量 静态代码块 加载顺序问题
在网上看了一个这样的题目 public class StaticTest { public static void main(String[] args) { staticFunction(); } ...
- 【BZOJ4883】 [Lydsy1705月赛]棋盘上的守卫(最小生成树,基环树)
传送门 BZOJ Solution 考虑一下如果把行,列当成点,那么显然这个东西就是一个基环树对吧. 直接按照\(Kruscal\)那样子搞就好了. 代码实现 代码戳这里
- Flask上下文
Flask的核心机制!关于请求处理流程和上下文 学习一样东西不能只停留在表面,我们要探索其中的细节,学习作者的编程思想,这样才能更进一步. 关于WSGI WSGI(全称Web Server Gatew ...
- Java集合排序(面试必考点之一)
集合是Java面试必考知识点,而集合的排序也是非常重要的,工作中经常用到,那么这个知识点也是必须要掌握的,下面是我曾经面试时被面试官问的问题: 根据API可知,Java集合的工具类Collection ...
- FFmpeg 学习(二):Mac下安装FFmpeg
一.安装ffmpeg 分为两种安装方式: 1. 命令行安装 brew install ffmpeg 2. 下载压缩包安装 去 http://evermeet.cx/ffmpeg/ 下载7z压缩包,解压 ...
- HTTP 协议常见的状态码
HTTP状态码负责表示客户端HTTP请求的返回结果.标记服务器端的处理是否正常.通知出现的错误等工作. 状态码的类别: 记录在RFC2616上的HTTP状态码有40种,再加上WebDAV等的扩展,数量 ...
- sql的转义字符单引号
在SQL中,我们都知道单引号 ' 表示字符串的开始和结束符号,如: select * from students where name = '小明'; 但如果字符串里面有单引号时,应该怎么查询呢? 这 ...
- C语言中关键字restrict的概念,使用范围,例子
概念: restrict,C语言中的一种类型限定符(Type Qualifiers),用于告诉编译器,对象已经被指针所引用,不能通过除该指针外所有其他直接或间接的方式修改该对象的内容. 渊源: res ...