`

Spring2.0事务管理..对每个类单独进行事务管理

    博客分类:
  • J2EE
阅读更多
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="txProxyTemplate" abstract="true" lazy-init="true"
  class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
  <property name="transactionManager" ref="transactionManager" />
  <property name="transactionAttributes">
   <props>
    <prop key="save*">PROPAGATION_REQUIRED</prop>
    <prop key="delete*">PROPAGATION_REQUIRED</prop>
    <prop key="remove*">PROPAGATION_REQUIRED</prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
   </props>
  </property>
</bean>

<!-- Generic manager that can be used to do basic CRUD operations on any objects -->
<bean id="baseManager" parent="txProxyTemplate">
  <property name="target">
   <bean
    class="com.wondtech.framework.service.impl.BaseManagerImpl">
    <property name="baseDao" ref="baseDao" />
   </bean>
  </property>
</bean>

<!-- authorization proxy bean -->
<bean id="sysUserAuthorization" parent="txProxyTemplate">
  <property name="target">
   <bean
    class="com.wondtech.core.authorization.service.impl.AuthorizationProxyImpl">
    <property name="sysLogDao" ref="sysLogDao" />
    <property name="roleFunctiondao"
     ref="sysRoleFunctionDao" />
    <property name="userRoledao" ref="sysUserRoleDao" />
    <property name="userPermissdao" ref="sysUserPermissDao" />
    <property name="functiondao" ref="sysFunctionDao" />
   </bean>
  </property>
  <property name="transactionAttributes">
   <props>
    <prop key="save*">
     PROPAGATION_REQUIRED,+ManagerException
    </prop>
    <prop key="delete*">
     PROPAGATION_REQUIRED,-ManagerException
    </prop>
    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
   </props>
  </property>
</bean>

</beans>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics