yj10864

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  8 Posts :: 1 Stories :: 9 Comments :: 0 Trackbacks
第一种方法:放开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>
posted on 2009-10-30 17:37 jerry yang 阅读(186) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: