标签:class java ext int http get
org.hibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session:
[org.fzegplat.hibernate.po.BAction#50]
at
org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:556)
at
org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:70)
at
org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:761)
at
org.hibernate.impl.SessionImpl.delete(SessionImpl.java:739)
at
org.fzegplat.hibernate.dao.BActionDao.delete(BActionDao.java:55)
at
org.fzegplat.hibernate.delegate.BActionDelegate.delAction(BActionDelegate.java:71)
at
org.fzegplat.struts.basicaction.B_action_delAction.execute(B_action_delAction.java:45)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
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.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.Http11Processor.process(Http11Processor.java:868)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at
java.lang.Thread.run(Thread.java:595)
org.fzegplat.well.exception.DaoException:
org.hibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session:
[org.fzegplat.hibernate.po.BAction#50]
at
org.fzegplat.hibernate.dao.BActionDao.delete(BActionDao.java:59)
at
org.fzegplat.hibernate.delegate.BActionDelegate.delAction(BActionDelegate.java:71)
at
org.fzegplat.struts.basicaction.B_action_delAction.execute(B_action_delAction.java:45)
at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
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.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.Http11Processor.process(Http11Processor.java:868)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by:
org.hibernate.NonUniqueObjectException: a different object with the same
identifier value was already associated with the session:
[org.fzegplat.hibernate.po.BAction#50]
at
org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:556)
at
org.hibernate.event.def.DefaultDeleteEventListener.onDelete(DefaultDeleteEventListener.java:70)
at
org.hibernate.impl.SessionImpl.fireDelete(SessionImpl.java:761)
at
org.hibernate.impl.SessionImpl.delete(SessionImpl.java:739)
at
org.fzegplat.hibernate.dao.BActionDao.delete(BActionDao.java:55)
... 22 more
这个异常发生当你用session.load 或 session.get加载一个对象时 而又尝试着
session.update
or session.lock
操作此对象
解决:
请不要用session加载对对象当你引用或再次使用该对象
由于我在做删除或修改数据操作时,而同时又查询,在查询中我没有关闭session
而造成 a different object with the same identifier value was already associated
with the session
NonUniqueObjectException 问题,布布扣,bubuko.com
标签:class java ext int http get
原文地址:http://www.cnblogs.com/xinzehome/p/3716626.html