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 sessions
Caused by: 
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
	at 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)

 理由:
システム内の同じビジネス処理中に、1つのセッション内のオブジェクトが別のセッションにアクセスされ、ビジネス処理中に2つのセッションが同時に開かれる可能性があります.
解決策:
前のSessoinを閉じてから次のSessionの業務を処理するか、同じSessionに業務処理を統合します.