---
title: "spring事务管理"
author: "a11632"
date: "2012-09-10T22:32:12Z"
tags: []
categories: ["开源软件"]
slug: "spring"
draft: false
lastmod: "2012-09-10T22:32:46Z"
id: 1675410
url: "https://a11632.iteye.com/blog/1675410"
---

&lt;bean id="transactionManager"  
       class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;  
   &lt;property name="sessionFactory" ref="sessionFactory"&gt;&lt;/property&gt;  
&lt;/bean&gt;

 

&lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt;  
   &lt;tx:attributes&gt;  
     &lt;tx:method name="update\*" propagation="REQUIRED" /&gt;  
     &lt;tx:method name="save\*" propagation="REQUIRED" /&gt;  
     &lt;tx:method name="del\*" propagation="REQUIRED" /&gt;  
     &lt;tx:method name="\*" read-only="true" /&gt;  
   &lt;/tx:attributes&gt;  
&lt;/tx:advice&gt;

 

&lt;aop:config proxy-target-class="true" &gt;  
   &lt;aop:pointcut expression="execution(* com.love2825.daoImpl.\*.\*(..))"  
       id="allMethod" /&gt;  
   &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="allMethod" /&gt;  
&lt;/aop:config&gt;