第一種方法:放開session
Session session=this.getSession();
this.releaseSession(session)
第二種方法配置事物:在applicationContext.xml中加入
<!-- 事務 -->
<bean id="tm" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="txAdvisor" transaction-manager="tm">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:advisor pointcut="execution(public * com.syy.cms.service.*.*(..))" advice-ref="txAdvisor"/>
</aop:config>



















