论坛首页 入门技术论坛

老生常谈的session的问题

浏览 10625 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-02-09  
我又想了一下——Set本身的特性决定了里面不存在重复的元素……既然这里你能add()进去,那就是说Set集合是OK的。

先用你注释掉的那行代码在save()动作之前清空Session看看行不行:
....

this.getRiskDutyFactorDAO().getCurrentSession().clear(); 
this.getRiskDutyDAO().save(riskDuty);

....

又或者尝试一下以merge()方法来完成持久化(这样应该就不会因为cascade="save-update"而触动到关联的集合端):
....

//也许可以直接写:this.getRiskDutyFactorDAO().merge(riskDuty); 
this.getRiskDutyFactorDAO().getCurrentSession().merge(riskDuty); 

....

另外问一下,你的DAO里面的save()用的是Session的saveOrUpdate()方法吗?
0 请登录后投票
   发表时间:2007-02-10  
hi,allen:
对于第一种方法,我忘记试过没有,不过我会尝试下的,但是我试过将清空Session放在save()后做过,结果是没有对数据库进行操作。
也在riskDuty.setDutyname(dutyName);前加过,没有什么效果,执行了,但是还是报同样的错。
merge()也尝试了,不过好象还不太会用。我DAO里的save()是save()方法,不是saveOrUpdate().

可能我那里还是有问题的,春节过后,我把代码整理下,发给你,你帮忙给我看看吧,现在我没有代码,放在公司了,我已经请假回家了!

谢谢!顺便祝看我帖子的人新年快乐!
0 请登录后投票
   发表时间:2007-02-10  
在getRiskDutyFactorByPk(new Integer(baseChecked[i])));时不应该出现这个错误吧,代码贴了很多,为什么不把出错信息贴全呢
0 请登录后投票
   发表时间:2007-02-10  
应该是这个的错的,在执行第一次save()方法的时候,通过getRiskDutyFactorByPk(new Integer(baseChecked[i])));方法取得一个RiskDutyFactor对象,但是session没有及时关闭,等执行第2次的时候,同样取得的是一个RiskDutyFactor对象,虽然说ID是一样的,但是对象已经不一样,才可以报这样的错误。

我现在手头上没有代码了,等回来后,把代码打包,发上来,希望大家能批评一下。
0 请登录后投票
   发表时间:2007-02-10  
一个session中如果关联了或者说缓存了一个对象,当get或load该id时,只要该对象没有被evict并且该session没有被clear或close过,那么总是会从缓存中直接取,否则查询数据库。session之间是相互独立的,一个session不会去取另一个session缓存中的对象,另一个session缓存中的对象对它来说是游离对象。

一个session中如果关联了或者说缓存了一个对象,当你将另一个相同id的游离对象与该session关联起来时会报那个错误。
0 请登录后投票
   发表时间:2007-02-16  
楼主的问题我也遇到过了,把session先clear一下就好了,Allen的方法正解!

楼上说:“一个session中如果关联了或者说缓存了一个对象,当你将另一个相同id的游离对象与该session关联起来时会报那个错误。”

这里有个疑问:为什么会出现“一个相同id的游离对象”。如果取这条数据的持久化对象,不论从session取还是查数据库只有一个,怎么就会出现“一个相同id的游离对象”?
0 请登录后投票
   发表时间:2007-02-16  
举个例子:

首先查询id为5的User对象 .
Userinfo user = (Userinfo)this.getObject(Userinfo.class, new Long(5))


再执行一个查询
String sql = "select user from User user";
List list = this.getByHqlList(sql);

最后:
user.set***();
this.update(); 

//居然有问题??? 我改成先session.clear()再update,通过!!
//以上是我简化了实际业务的情况,遇到和楼主同样的错!
//难道这样写法不行??? 望指教!!!

0 请登录后投票
   发表时间:2007-02-17  
可能在
引用
首先查询id为5的User对象 .
Userinfo user = (Userinfo)this.getObject(Userinfo.class, new Long(5))

时是一个session,而在
引用
再执行一个查询
String sql = "select user from User user";
List list = this.getByHqlList(sql);

最后:
user.set***();
this.update();

时是另一个session,可以调试看看是不是同一个session。
0 请登录后投票
   发表时间:2007-02-25  
1.数据库目前为DB2 8.2
2.执行sleb/crebas_db2.sql里的sql,生成数据库表
3.部署后先执行http://10.156.4.31:8090/sleb/riskDutyFactor/saveRiskDutyFactor.jsp,添加几个内容,后执行
http://10.156.4.31:8090/sleb/riskDuty/saveRiskDutyLink.jsp,点查询,后任意增加几个内容。第一次增加的时候不会报错,第2次就会出现错误。
所有日志如下:

13:22:14,061 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true
13:22:14,139 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
13:22:14,139 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,155 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,155 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,155 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,217 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,217 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,217 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:14,217 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:22:24,226 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.actions.LocalStrings', returnNull=true
13:22:24,336 INFO  [JdbcTransactionObjectSupport] JDBC 3.0 Savepoint class is available
13:22:24,508 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
13:22:24,570 INFO  [SQLErrorCodesFactory] SQLErrorCodes loaded: [DB2, HSQL, MS-SQL, MySQL, Oracle, Informix, PostgreSQL, Sybase]
13:22:24,820 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.FACTORNAME='保险期间' )
13:22:25,038 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:22:25,241 INFO  [RiskDutyFactorDAOImpl] save successful
13:22:25,241 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:22:25,241 INFO  [RiskDutyFactorDAOImpl] save successful
13:22:25,241 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:22:25,241 INFO  [RiskDutyFactorDAOImpl] save successful
13:22:25,304 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:22:25,319 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:22:25,319 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:22:25,757 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.bean.LocalStrings', returnNull=true
13:23:05,106 INFO  [SaveRiskDutyFactorForm] factorUnitStr.length and factotValueStr.length are 0
13:23:05,121 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.FACTORNAME='费率' )
13:23:05,121 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:05,121 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:05,121 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:12,304 INFO  [SaveRiskDutyFactorForm] factotValueStr.length is 0
13:23:12,335 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.FACTORNAME='计算方向' )
13:23:12,335 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:12,335 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:12,335 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:12,351 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:12,351 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:12,351 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:12,351 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:12,351 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:12,367 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:12,367 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:12,367 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:12,382 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:16,942 INFO  [SaveRiskDutyFactorForm] factorUnitStr.length and factotValueStr.length are 0
13:23:16,957 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.FACTORNAME='免赔额' )
13:23:16,973 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:16,973 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:16,973 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:20,830 INFO  [SaveRiskDutyFactorForm] factorUnitStr.length and factotValueStr.length are 0
13:23:20,861 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.FACTORNAME='赔付比例' )
13:23:20,861 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:20,861 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:20,877 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:26,248 INFO  [SaveRiskDutyFactorForm] factorUnitStr.length and factotValueStr.length are 0
13:23:26,279 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.FACTORNAME='住院期间' )
13:23:26,279 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTYFACTOR
13:23:26,279 INFO  [RiskDutyFactorDAOImpl] save successful
13:23:26,295 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTYFACTOR (FACTORNAME, FACTORUNIT, VALUE, SIGN, LANGUAGE, RISKDUTYFACTORID) values (?, ?, ?, ?, ?, ?)
13:23:34,867 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true
13:23:36,725 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:25:05,542 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='0' )
13:25:05,604 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='0' )
13:25:05,604 INFO  [STDOUT] false
13:25:05,636 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='1' )
13:25:05,667 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='1' )
13:25:05,667 INFO  [STDOUT] false
13:25:05,698 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true
13:25:05,714 INFO  [PropertyMessageResources] Initializing, config='org.apache.struts.taglib.html.LocalStrings', returnNull=true
13:27:47,029 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTY riskduty0_ where (riskduty0_.DUTYNAME='公共交通意外伤害' )
13:27:47,076 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_0_, riskdutyfa0_.FACTORNAME as FACTORNAME0_0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_0_, riskdutyfa0_.VALUE as VALUE0_0_, riskdutyfa0_.SIGN as SIGN0_0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where riskdutyfa0_.RISKDUTYFACTORID=?
13:27:47,123 INFO  [RiskDutyServiceImpl] 保险期间       
13:27:47,123 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_0_, riskdutyfa0_.FACTORNAME as FACTORNAME0_0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_0_, riskdutyfa0_.VALUE as VALUE0_0_, riskdutyfa0_.SIGN as SIGN0_0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where riskdutyfa0_.RISKDUTYFACTORID=?
13:27:47,138 INFO  [RiskDutyServiceImpl] 计算方向       
13:27:47,138 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_0_, riskdutyfa0_.FACTORNAME as FACTORNAME0_0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_0_, riskdutyfa0_.VALUE as VALUE0_0_, riskdutyfa0_.SIGN as SIGN0_0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where riskdutyfa0_.RISKDUTYFACTORID=?
13:27:47,154 INFO  [RiskDutyServiceImpl] 费率             
13:27:47,154 INFO  [RiskDutyServiceImpl] begin save complexCheck riskDuty
13:27:47,154 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTY
13:27:47,154 INFO  [RiskDutyDAOImpl] save successful
13:27:47,170 INFO  [STDOUT] Hibernate: insert into XFLIU.RISKDUTY (DUTYNAME, DUTYTYPE, LANGUAGE, RISKDUTYID) values (?, ?, ?, ?)
13:27:47,185 INFO  [STDOUT] Hibernate: insert into FACTORRISKDUTY (RISKDUTYID, RISKDUTYFACTORID) values (?, ?)
13:27:47,997 INFO  [STDOUT] Hibernate: insert into FACTORRISKDUTY (RISKDUTYID, RISKDUTYFACTORID) values (?, ?)
13:27:47,997 INFO  [STDOUT] Hibernate: insert into FACTORRISKDUTY (RISKDUTYID, RISKDUTYFACTORID) values (?, ?)
13:27:48,028 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='0' )
13:27:48,044 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='0' )
13:27:48,044 INFO  [STDOUT] false
13:27:48,075 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='1' )
13:27:48,075 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_, riskdutyfa0_.FACTORNAME as FACTORNAME0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_, riskdutyfa0_.VALUE as VALUE0_, riskdutyfa0_.SIGN as SIGN0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where (riskdutyfa0_.SIGN='1' )
13:27:48,091 INFO  [STDOUT] false
13:28:11,263 INFO  [STDOUT] Hibernate: select count(*) as col_0_0_ from XFLIU.RISKDUTY riskduty0_ where (riskduty0_.DUTYNAME='意外死亡' )
13:28:11,279 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_0_, riskdutyfa0_.FACTORNAME as FACTORNAME0_0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_0_, riskdutyfa0_.VALUE as VALUE0_0_, riskdutyfa0_.SIGN as SIGN0_0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where riskdutyfa0_.RISKDUTYFACTORID=?
13:28:11,279 INFO  [RiskDutyServiceImpl] 保险期间       
13:28:11,279 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_0_, riskdutyfa0_.FACTORNAME as FACTORNAME0_0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_0_, riskdutyfa0_.VALUE as VALUE0_0_, riskdutyfa0_.SIGN as SIGN0_0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where riskdutyfa0_.RISKDUTYFACTORID=?
13:28:11,294 INFO  [RiskDutyServiceImpl] 计算方向       
13:28:11,294 INFO  [STDOUT] Hibernate: select riskdutyfa0_.RISKDUTYFACTORID as RISKDUTY1_0_, riskdutyfa0_.FACTORNAME as FACTORNAME0_0_, riskdutyfa0_.FACTORUNIT as FACTORUNIT0_0_, riskdutyfa0_.VALUE as VALUE0_0_, riskdutyfa0_.SIGN as SIGN0_0_, riskdutyfa0_.LANGUAGE as LANGUAGE0_0_ from XFLIU.RISKDUTYFACTOR riskdutyfa0_ where riskdutyfa0_.RISKDUTYFACTORID=?
13:28:11,294 INFO  [RiskDutyServiceImpl] 费率             
13:28:11,294 INFO  [RiskDutyServiceImpl] begin save complexCheck riskDuty
13:28:11,294 INFO  [STDOUT] Hibernate: values nextval for S_RISKDUTY
13:28:11,310 ERROR [RiskDutyDAOImpl] save failed
org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [com.sleb.po.Riskdutyfactor#5]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.sleb.po.Riskdutyfactor#5]
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.sleb.po.Riskdutyfactor#5]
at org.hibernate.engine.PersistenceContext.checkUniqueness(PersistenceContext.java:586)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:254)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:214)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154)
at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771)
at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895)
at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792)
at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
at org.hibernate.engine.Cascades.cascade(Cascades.java:847)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:363)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:615)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:612)
at com.sleb.dao.base.BaseDao.save(BaseDao.java:100)
at com.sleb.service.riskDuty.spring.RiskDutyServiceImpl.saveRiskduty(RiskDutyServiceImpl.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy47.saveRiskduty(Unknown Source)
at com.sleb.struts.action.riskDuty.SaveRiskDutyAction.save(SaveRiskDutyAction.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.sleb.util.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:74)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
13:28:11,388 WARN  [RequestProcessor] Unhandled Exception thrown: class org.springframework.orm.hibernate3.HibernateSystemException
13:28:11,435 ERROR [Engine] StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [com.sleb.po.Riskdutyfactor#5]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.sleb.po.Riskdutyfactor#5]
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.sleb.po.Riskdutyfactor#5]
at org.hibernate.engine.PersistenceContext.checkUniqueness(PersistenceContext.java:586)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:254)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:214)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
at org.hibernate.engine.Cascades$5.cascade(Cascades.java:154)
at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:771)
at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
at org.hibernate.engine.Cascades.cascadeCollection(Cascades.java:895)
at org.hibernate.engine.Cascades.cascadeAssociation(Cascades.java:792)
at org.hibernate.engine.Cascades.cascade(Cascades.java:720)
at org.hibernate.engine.Cascades.cascade(Cascades.java:847)
at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:363)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at org.springframework.orm.hibernate3.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:615)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
at org.springframework.orm.hibernate3.HibernateTemplate.save(HibernateTemplate.java:612)
at com.sleb.dao.base.BaseDao.save(BaseDao.java:100)
at com.sleb.service.riskDuty.spring.RiskDutyServiceImpl.saveRiskduty(RiskDutyServiceImpl.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy47.saveRiskduty(Unknown Source)
at com.sleb.struts.action.riskDuty.SaveRiskDutyAction.save(SaveRiskDutyAction.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at com.sleb.util.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:74)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
  • sleb.zip (100.8 KB)
  • 描述: 1.数据库目前为DB2 8.2 2.执行sleb/crebas_db2.sql里的sql,生成数据库表 3.部署后先执行http://10.156.4.31:8090/sleb/riskDutyFactor/saveRiskDutyFactor.jsp,添加几个内容,后执行 http://10.156.4.31:8090/sleb/riskDuty/saveRiskDutyLink.jsp,点查询,后任意增加几个内容。第一次增加的时候不会报错,第2次就会出现错误。
  • 下载次数: 0
0 请登录后投票
   发表时间:2007-02-26  
大家还在过年吗?呵呵!
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics