当前位置: 代码迷 >> Java Web开发 >> 啥错呀?我用myEclipse调Hibernate的DAO就报500了
  详细解决方案

啥错呀?我用myEclipse调Hibernate的DAO就报500了

热度:379   发布时间:2007-08-30 18:44:23.0
啥错呀?我用myEclipse调Hibernate的DAO就报500了

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: a different object with the same identifier value was already associated with the session: [entity.User#abc]
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.User#abc]
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:154)
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
dao.UserDAO.save(UserDAO.java:29)
org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

搜索更多相关主题的帖子: DAO  myEclipse  Hibernate  jasper  apache  

----------------解决方案--------------------------------------------------------
a different object with the same identifier value was already associated with the session

检查你的用户表,你在尝试向数据库中插入重复的ID,这当然报错啦

----------------解决方案--------------------------------------------------------

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: a different object with the same identifier value was already associated with the session: [entity.User#wangmou]
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.User#wangmou]
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:154)
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:114)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:530)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:518)
org.hibernate.impl.SessionImpl.save(SessionImpl.java:514)
dao.UserDAO.save(UserDAO.java:29)
org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

我又换了一个wangmou还是不行呀

数据里没有wangmou


----------------解决方案--------------------------------------------------------
然后我弄了Hibernate,但没弄Struts的时候可以.
可是加上Struts的时候就报错了.
----------------解决方案--------------------------------------------------------

把代码贴上来


----------------解决方案--------------------------------------------------------
明白了,谢谢.神vLinux飘飘
可以另一个问题又出来了,我哪个页面执行第一次的时候没报错,但是数据为什么没有添加进去??然后第二次又出错了

上传了,我用的是mysql
test2.part2.rar

[此贴子已经被作者于2007-8-30 23:25:01编辑过]


----------------解决方案--------------------------------------------------------
你上传的东西没有代码,全部都是一些LIB哦...

一般来说,没有报错,但是数据却没有添加进去很可能是数据库的事务没有提交。
然后第二次又出错那就要看出什么错了。也把错误的提示贴上来

----------------解决方案--------------------------------------------------------
不知道为啥,我重新建了,然后就好了,哈哈。谢谢斑竹
----------------解决方案--------------------------------------------------------
a different object with the same identifier value was already associated with the session:
----------------解决方案--------------------------------------------------------
  相关解决方案