错误信息

严重: 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的更多相关文章

  1. 【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 ...

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

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

  4. Hibernate异常:identifier of an instance of 错误

    今天写项目时,在使用hibernate封装的插入方法时,由于需要同时保存多个数据,导致出现identifier of an instance of 如下代码 :(由于最大最小分数不同所以需要插入两条数 ...

  5. 161117、使用spring声明式事务抛出 identifier of an instance of

    今天项目组有成员使用spring声明式事务出现下面异常,这里跟大家分享学习下. 异常信息: org.springframework.orm.hibernate3.HibernateSystemExce ...

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

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

  8. 问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found解决方法

    问题Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not fo ...

  9. spring整合hibernate的时候报异常org.hibernate.HibernateException: createQuery is not valid without active transaction

    在整合Spring4+hibernate4时候,当代码执行到dao中CRUD操作时,报了一个异常, org.hibernate.HibernateException: createQuery is n ...

随机推荐

  1. 03 of learning python

    01 input输入的是str类型 如果输入的是数字的话,要记得强制转换一下! 02 isdigit() 这个方法是用来检测字符串是否全部由数字组成 str.isdigit() 如果字符串只包含数字则 ...

  2. 微信屏蔽APP分享链接的解决方案原理,剖析微信域名防封技术

    为什么很多商家在微信封域名如此严格的情况下,还会挤破头皮去做微信营销和推广呢?又有些人问,为什么别人的域名长时间推广都没事,自己的链接在微信内一推就被拦截呢?这里你可能需要注意一点事,事出无常必有妖. ...

  3. day_6深浅拷贝,元组字典集合类型定义和各种操作方法

    首先我们来讲一下深浅拷贝 1:值拷贝,假设一个列表等于L1 再定义一个L2=L1  这样就是值拷贝 L2只是存的L1存列表的地址,所以当L1发生改变,L2也随之改变 2:浅拷贝,L2=L1.copy( ...

  4. [转] Vmware vs Virtualbox vs KVM vs XEN: virtual machines performance comparison

    http://www.ilsistemista.net/index.php/virtualization/1-virtual-machines-performance-comparison.html? ...

  5. 【腾讯Bugly干货分享】Android 新一代多渠道打包神器

    关于作者: 李涛,腾讯Android工程师,14年加入腾讯SNG增值产品部,期间主要负责手Q动漫.企鹅电竞等项目的功能开发和技术优化.业务时间喜欢折腾新技术,写一些技术文章,个人技术博客:www.lt ...

  6. JDK1.7和JDK1.8对于异常的支持

    嗨喽,伙伴们,上次我们讲了<Java异常解读以及通过业务逻辑解决异常的方式>和<java异常处理方式try-catch-finally>,相信大家对java异常及处理方式有所了 ...

  7. Javascript高级编程学习笔记(52)—— DOM2和DOM3(4)元素大小

    在日常实践中,我们在使用JS的时候难免会需要获取元素的大小及位置 首先要声明的是,这一部分的内容并不属于DOM2样式规范,因为DOM中并没有对我们如何获取元素大小的相关信息做出规范 偏移量 偏移量及元 ...

  8. 吴恩达机器学习笔记43-SVM大边界分类背后的数学(Mathematics Behind Large Margin Classification of SVM)

    假设我有两个向量,

  9. 吴恩达机器学习笔记1-单变量线性回归(Linear Regression with One Variable)

    在监督学习中我们有一个数据集,这个数据集被称训练集.

  10. idea 过段时间java程序包不存在问题 ?

    有时候我们在导入程序之后,系统会给出错误提示:Java:程序包xxxx不存在,现在我这里有一招,就是使用IDEA自动导入Java程序包,这也是IDEA的一大优点. 但是在看到这个问题的文章的时候,并不 ...