解决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 ...
随机推荐
- HAProxy详细中文用法详解
一.HAProxy简介 (1)HAProxy 是一款提供高可用性.负载均衡以及基于TCP(第四层)和HTTP(第七层)应用的代理软件,支持虚拟主机,它是免费.快速并且可靠的一种解决方案. HAProx ...
- VSCode插件开发全攻略(八)代码片段、设置、自定义欢迎页
更多文章请戳VSCode插件开发全攻略系列目录导航. 代码片段 代码片段,也叫snippets,相信大家都不陌生,就是输入一个很简单的单词然后一回车带出来很多代码.平时大家也可以直接在vscode中创 ...
- python爬虫学习之爬取全国各省市县级城市邮政编码
实例需求:运用python语言在http://www.ip138.com/post/网站爬取全国各个省市县级城市的邮政编码,并且保存在excel文件中 实例环境:python3.7 requests库 ...
- IM开发基础知识补课(五):通俗易懂,正确理解并用好MQ消息队列
1.引言 消息是互联网信息的一种表现形式,是人利用计算机进行信息传递的有效载体,比如即时通讯网坛友最熟悉的即时通讯消息就是其具体的表现形式之一. 消息从发送者到接收者的典型传递方式有两种: 1)一种我 ...
- 知识扩展——Git和GitHub的区别
一直以为Git和GitHub是一个东西,直到我看到这个解释.... 转载自:git与github区别与简介 一开始接触git或是github的程序员可能搞不太清楚这些名词到底指代的是什么,所以在这里稍 ...
- 网站后台搭建--springboot项目是如何创建的
在创建项目之前先说一下ide的问题,从学习软件开始一直到一个月之前,开发用的IDE都是Eclipse,对,就是这个远古时代的开发工具,在使用过程中虽然总是遇到各种bug,但内心里还是存在着一丝理解的想 ...
- 心路历程(五)-find work and find house
今天,对我半年的java自学经历做一个总结吧,因为今天刚找到了房子,而工作在前两天已经找到.面试了两家,第一家是海淀去知春路的中科软,去之前就百度了这家公司,各种黑,然后自己去了之后,说说自己真实的感 ...
- 《用Python解决数据结构与算法问题》在线阅读
源于经典 数据结构作为计算机从业人员的必备基础,Java, c 之类的语言有很多这方面的书籍,Python 相对较少, 其中比较著名的一本 problem-solving-with-algorithm ...
- 项目总结三:目标检测项目(Car detection with YOLOv2)
1. the YOLO model (YOLO ,you only look once) (1)We will use 5 anchor boxes. So you can think of the ...
- redis 系列1 linux下安装说明
一. 安装环境 操作系统:centos 7 ,redis版本4.06,客户端windows 7 ,vs2015. 1.1 安装前的条件 yum -y install gcc-c++ 判断是否安装了gc ...