| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1324 人关注过本帖
标题:啥错呀?我用myEclipse调Hibernate的DAO就报500了
只看楼主 加入收藏
wangchen223
Rank: 1
等 级:新手上路
帖 子:149
专家分:0
注 册:2006-7-1
收藏
 问题点数:0 回复次数:8 
啥错呀?我用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 
2007-08-30 18:44
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
收藏
得分:0 
a different object with the same identifier value was already associated with the session

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

淘宝杜琨
2007-08-30 19:48
wangchen223
Rank: 1
等 级:新手上路
帖 子:149
专家分:0
注 册:2006-7-1
收藏
得分:0 

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


2007-08-30 22:11
wangchen223
Rank: 1
等 级:新手上路
帖 子:149
专家分:0
注 册:2006-7-1
收藏
得分:0 
然后我弄了Hibernate,但没弄Struts的时候可以.
可是加上Struts的时候就报错了.

2007-08-30 22:13
sea7
Rank: 2
等 级:新手上路
威 望:3
帖 子:291
专家分:0
注 册:2007-2-17
收藏
得分:0 

把代码贴上来


软件是一种修养
2007-08-30 23:06
wangchen223
Rank: 1
等 级:新手上路
帖 子:149
专家分:0
注 册:2006-7-1
收藏
得分:0 
明白了,谢谢.神vLinux飘飘
可以另一个问题又出来了,我哪个页面执行第一次的时候没报错,但是数据为什么没有添加进去??然后第二次又出错了

上传了,我用的是mysql
JErmdao7.rar (749.1 KB)
test2.part2.rar

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



wTa8IUZp.rar (781.36 KB)

2007-08-30 23:10
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
收藏
得分:0 
你上传的东西没有代码,全部都是一些LIB哦...

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

淘宝杜琨
2007-08-31 11:30
wangchen223
Rank: 1
等 级:新手上路
帖 子:149
专家分:0
注 册:2006-7-1
收藏
得分:0 
不知道为啥,我重新建了,然后就好了,哈哈。谢谢斑竹

2007-09-02 20:21
ConZhang
Rank: 1
来 自:北京
等 级:新手上路
帖 子:282
专家分:0
注 册:2007-8-7
收藏
得分:0 
a different object with the same identifier value was already associated with the session:
2007-09-02 21:07
快速回复:啥错呀?我用myEclipse调Hibernate的DAO就报500了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018461 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved