67,513
社区成员
发帖
与我相关
我的任务
分享
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
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:679)
String hql="from Roles where id in(";
for(int i=0;i<roles.length-1;i++)
{
hql+=roles[i]+",";
}
hql+=roles[roles.length-1]+")";
this.getHibernateTemplate().clear();
this.getHibernateTemplate().flush();
List<Roles> list=this.getHibernateTemplate().find(hql);
this.getHibernateTemplate().deleteAll(list);
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>false</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>