ibatis+spring控制事务配置

<bean id="dataSource" 
    class="org.apache.commons.dbcp.BasicDataSource">  
    <property name="driverClassName">  
        <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>  
    </property>  
    <property name="url">  
        <value>jdbc:microsoft:sqlserver://localhost:1433;DataBaseName=workspace</value>  
    </property>  
    <property name="username">  
        <value>sa</value>  
    </property>  
    <property name="password">  
        <value>123456</value>  
    </property>  
</bean>  
<bean id="transactionManager" 
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager" 
    abstract="false" singleton="true" lazy-init="default" 
    autowire="default" dependency-check="default">  
    <property name="dataSource">  
        <ref bean="dataSource" />  
    </property>  
</bean>  
<bean id="userDAO" class="org.xredleaf.dao.UserDAO" abstract="false" 
    singleton="true" lazy-init="default" autowire="default" 
    dependency-check="default">  
    <property name="dataSource">  
        <ref bean="dataSource" />  
    </property>  
    <property name="sqlMapClient">  
        <ref bean="sqlMapClient" />  
    </property>  
</bean>  
 
<bean id="userDAOProxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">    
     <property name="transactionManager">    
         <ref bean="transactionManager" />    
     </property>    
     <property name="target">    
          <ref bean="userDAO" />    
.    </property>    
     <property name="transactionAttributes">    
         <props>    
            <prop key="insert*">PROPAGATION_REQUIRED</prop>    
.        </props>    
    </property>    
</bean> 

你可能感兴趣的:(spring,ibatis,jdbc,Microsoft)