spring声明式事务管理的xml配置

<!-- 事务管理器 -->

<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<!-- 事务参数 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" propagation="REQUIRED" read-only="true" rollback-for="Exception" />
</tx:attributes>
</tx:advice>

<aop:config>
<!-- 事务切面 -->
<aop:advisor advice-ref="txAdvice"
pointcut="execution(* com.helloworld+.*(..))" />
</aop:config>

猜你喜欢

转载自87430997.iteye.com/blog/1756470