关于spring事务配置的代码

来源:百度知道 编辑:UC知道 时间:2024/09/28 07:06:57
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
这里的PROPAGATION_REQUIRED和readOnly都是什么意思?

有解释PROPAGATION_REQUIRED表示支持当前事务,如果当前没有事务,就新建一个事务。不太明白,所谓‘事务’在哪里? 请具体解释PROPAGATION_REQUIRED和readOnly都是什么意思?

十分感激!

首先
你知道什么是事务么
然后
你知道spring是怎么管理事务的么
最后
你就明白这么配有什么用了

spring配置事务的代码:
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>

<!-- 配置事务的传播特性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED"/>
<tx:method name="del*" propagation="REQUIRED"/>
<tx:method name="modify*" propagation="REQUIRED"/>
<tx:method name="*" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>

<!-- 那些类的哪些方法参与事务 -->
<aop:config&g