首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

two open sessions错误

2012-07-24 
two open sessions异常异常:org.springframework.orm.hibernate3.HibernateSystemException: Illegal atte

two open sessions异常

异常:

org.springframework.orm.hibernate3.HibernateSystemException: Illegal attempt to associate a collection with two open sessions; nested exception is org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessionsCaused by: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessionsat org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:410)at org.hibernate.event.def.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:43)at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:123)

?原因:

系统中同一业务处理过程中,一个Session中对象可能被另一个Session访问,且业务处理过程中同时开了两个session

解决办法:

关闭上一个Sessoin后再接着处理下一个Session的业务,或将 业务处理合并到同一个Session中

热点排行