标签:odi 隔离 save 配置 事务管理 attribute load data nta
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<tx:advice id="txAdvice"
transaction-manager="transactionManager">
<tx:attributes>
<!--对方法级别设置事务的隔离级别、传播行为-->
<!--设置了默认的隔离级别-->
<!--添加-->
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="create*" propagation="REQUIRED" />
<!--删除-->
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<!--修改-->
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="modify*" propagation="REQUIRED" />
<!--查询-->
<tx:method name="find*" propagation="SUPPORTS" read-only="true" />
<tx:method name="select*" propagation="SUPPORTS" read-only="true" />
<tx:method name="get*" propagation="SUPPORTS" read-only="true" />
</tx:attributes>
<aop:config>
<!-- 这使用的是Spring AOP的实现 -->
<!-- advice-ref:指定advice增强类 -->
<!-- pointcut:指定切点 -->
<aop:advisor advice-ref="txAdvice"
pointcut="execution(* *..*.*ServiceImpl.*(..))" />
</aop:config>
<!-- 配置事务管理器 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"></property>
</bean>
<!-- 配置事务注解驱动 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
@EnableTransactionManagement
标签:odi 隔离 save 配置 事务管理 attribute load data nta
原文地址:https://www.cnblogs.com/BonnieWss/p/12217283.html