码迷,mamicode.com
首页 > 编程语言 > 详细

Spring AOP 管理事务

时间:2017-03-23 15:56:43      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:nat   hibernate   bsp   efault   color   work   exec   method   false   

    <aop:config proxy-target-class="true">
        <aop:pointcut expression="execution(* com.jikexueyuan.dao.impl.*.*(..))" id="cut"/>
        <aop:advisor advice-ref="defaultTransactionAdvice" pointcut-ref="cut"/>        
    </aop:config>
    
    <bean id="transactionManager"
        class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
        <property name="dataSource" ref="datasource"></property>  
    </bean>
    <tx:advice transaction-manager="transactionManager" id="defaultTransactionAdvice">
             <tx:attributes>  
                  <tx:method name="add*" read-only="false"/> 
               <tx:method name="*"/>  
          </tx:attributes> 
    </tx:advice>

 

Spring AOP 管理事务

标签:nat   hibernate   bsp   efault   color   work   exec   method   false   

原文地址:http://www.cnblogs.com/HardRockVersion/p/6605500.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!