解决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 ...
随机推荐
- 与Servlet相关的类
有4个有关的类,通过servlet可以获得其中的三个,然后通过ServletConfig间接获取ServletContext.1. ServletConfig该类是在Servlet容器初始化Servl ...
- shiro授权测试
shiro-permission.ini 创建存放权限的配置文件shiro-permission.ini,如下: [users] #用户zhang的密码是1111111,此用户具有role1和role ...
- CS61A hw01
前不久在知乎上看到CS61A 和CS61B spring18 开课的消息.上去看了一眼,发现真的不错,所有proj hw都可以本地测试!也就是说除了没有课程成绩和官方讨论区和TA解答外,这个课完全可以 ...
- Openvswitch手册(6): QoS
这一节我们看QoS,Qos的设置往往是和flow中的policy一起使用的 Open vSwitch QoS capabilities 1 Interface rate limiting 2 Port ...
- ASP.NET Core MVC 源码学习:详解 Action 的匹配
前言 在 上一篇 文章中,我们已经学习了 ASP.NET Core MVC 的启动流程,那么 MVC 在启动了之后,当请求到达过来的时候,它是怎么样处理的呢? 又是怎么样把我们的请求准确的传达到我们的 ...
- 【腾讯Bugly干货分享】iOS App 签名的原理
本文来自 WeRead 团队博客: http://wereadteam.github.io/ iOS 签名机制挺复杂,各种证书,Provisioning Profile,entitlements,Ce ...
- Numpy学习四:numpy.power()用法
numpy.power(n, x) 对数组n的元素分别求x次方.x可以是数字,也可以是数组,但是n和x的列数要相同.
- MySQL-8.0.11 在 Windows10 上的安装
下载 MySQL8.0 For Windows zip包下载地址:https://dev.mysql.com/downloads/file/?id=476233. 进入页面后可以不登录,点击底部“No ...
- hbaes之createTable执行流程
hbase的客户端代码并不想hive一样用java编写,shell调用,而是使用ruby编写. 在admin.rb文件中方法create,其中接受两个参数,其中第二个参数类型为变长参数. 而在crea ...
- Jenkins系列之四——设置邮件通知
Jenkins持续集成,当我们自动打包部署完,我们可以发送一封邮件给相关的负责人.现介绍一下如何在Jenkins中配置实现邮件通知. 在Jenkins中配置实现邮件通知,Jenkins提供了两种方式的 ...