spring2.0 事务配置

来源:互联网 发布:电气工程软件 编辑:程序博客网 时间:2024/06/05 22:45

<!-- ================txAdvice=================== -->
    <!-- 事务处理相关begin -->
    <bean id="myHibTransactionManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <tx:advice id="txAdvice"
        transaction-manager="myHibTransactionManager">
        <tx:attributes>
            <tx:method name="add*" propagation="REQUIRED" />
            <tx:method name="del*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="*" propagation="SUPPORTS" read-only="true" />
        </tx:attributes>
    </tx:advice>
    <aop:config>
        <aop:pointcut id="bizMethods"
            expression="execution(* com.lichaotao.biz.*.*(..))" />
            <!-- 对所有co.accp.biz包下的所有类的所有方法均进行事务管理 -->
        <aop:advisor advice-ref="txAdvice" pointcut-ref="bizMethods" />
    </aop:config>
    <!-- 事务处理相关end -->

原创粉丝点击