ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • ibatis,spring transaction setting 설정
    카테고리 없음 2022. 8. 2. 15:48
    728x90
    반응형

    셋팅하기전에..spring-tx lib랑spring-jdbc 버전을 맞추어주자.. 이거때문에 삽질했었다.. 

     

     

    <bean id="doTransaction"
    		  class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    		<property name="dataSource" ref="doDataSource" />
    	</bean>
    
    
    	<bean id="doSqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    		<property name="configLocation" value="/WEB-INF/config/doSqlMapConfig.xml" />
    		<property name="dataSource" ref="doDataSource" />
    	</bean>
    
    	<tx:advice id="txAdvice" transaction-manager="doTransaction">
    		<tx:attributes>
    			<!-- all methods starting with 'get' are read-only -->
    			<tx:method name="get*" read-only="true" rollback-for="Exception"/>
    			<!-- other methods use the default transaction settings (see below) -->
    			<tx:method name="save*" propagation="REQUIRED"/>
    			<tx:method name="update*" propagation="REQUIRED"/>
    			<tx:method name="insert*" propagation="REQUIRED"/>
    			<tx:method name="delete*" propagation="REQUIRED"/>
    			<tx:method name="set*" propagation="REQUIRED"/>
    		</tx:attributes>
    	</tx:advice>
    
    	<aop:config>
    		<aop:pointcut id="txPointcut" expression="execution(* kr.co.example.service..*Imp.*(..))" />
    		<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" />
    	</aop:config>
    728x90
    반응형
Designed by Tistory.