标签:context int 细节 def nes spring for ctf str
错误信息
严重: 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时能用快捷键就用快捷键
标签:context int 细节 def nes spring for ctf str
原文地址:https://www.cnblogs.com/aihuadung/p/10202463.html