梦开始的地方----

梦延续的港湾----

常用链接

统计

积分与排名

最新评论

2006年8月19日 #

hibernate修改出错,

在订单中ORDERS,把A部门为B部门,出现
identifier of an instance of com.kink.model.Department altered from 2 to 4; nested exception is org.hibernate.HibernateException: identifier of an instance of com.kink.model.Department altered from 2 to 4 ,是不是哪个地方没设置好,2是A部门原来的值,4是要修改成的值。

注:Orders表的字段为 id(PK),dept_id(FK),remark,
Order_item 表的字段为id,order_id(FK),item_no,qty,price,
Department 表的字段为id(PK),code,name,
出现以上操作错误是在对orders进行UPDATE时出现的,步骤是取出Orders 然后把订单中的A部门修改成B部门,就出现错误,而我却没有对Department表进行操作,不知道是怎么回事,请问有人知道原因吗

posted @ 2006-08-25 13:41 梦延续的港湾----依然是蓝 阅读(1300) | 评论 (2)编辑 收藏

征集hibernate错误答案

Q:identifier of an instance of com.lanhan.poos.vo.Ck was altered from 1 to 2; nested exception is org.hibernate.HibernateException: identifier of an instance of com.lanhan.poos.vo.Ck was altered from 1 to 2
Stack Trace is :

org.springframework.orm.hibernate3.HibernateSystemException: identifier of an instance of com.lanhan.poos.vo.Ck was altered from 1 to 2; nested exception is org.hibernate.HibernateException: identifier of an instance of com.lanhan.poos.vo.Ck was altered from 1 to 2
Caused by: org.hibernate.HibernateException: identifier of an instance of com.lanhan.poos.vo.Ck was altered from 1 to 2
 at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:51)
 at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:150)
 at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:106)
 at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
 at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
 at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
 at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
 at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
 at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
 at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:580)
 at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:539)
 at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:509)
 at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:275)
 at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
 at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:647)
 at com.lh.pos.dao.impl.BorrowDAOImpl$$EnhancerByCGLIB$$61171362.updateBorrow()
 at com.lh.pos.web.ck.BorrowController.update(BorrowController.java:152)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:216)
 at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:162)
 at org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.java:114)
 at com.lh.pos.web.ck.BorrowController.handleRequest(BorrowController.java:67)
 at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:45)
 at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
 at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:728)
 at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:396)
 at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:360)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.extremecomponents.table.filter.AbstractExportFilter.doFilter(AbstractExportFilter.java:49)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:151)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:833)
 at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:639)
 at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1285)
 at java.lang.Thread.run(Unknown Source)

更新记录时出错以上错误,有知道问题的答案吗,很想搞清楚问题出在哪里

posted @ 2006-08-19 22:12 梦延续的港湾----依然是蓝 阅读(2027) | 评论 (6)编辑 收藏