블로그 이미지

calendar

1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
  • total
  • today
  • yesterday
2015. 12. 4. 15:18 JAVA오픈소스/Spring

Multiple Transaction Managers with @Transactional

Most Spring applications only need a single transaction manager, but there may be situations where you want multiple independent transaction managers in a single application. The value attribute of the @Transactional annotation can be used to optionally specify the identity of the PlatformTransactionManager to be used. This can either be the bean name or the qualifier value of the transaction manager bean. For example, using the qualifier notation, the following Java code

public class TransactionalService {

    @Transactional("order")
    public void setSomething(String name) { ... }

    @Transactional("account")
    public void doSomething() { ... }
}

could be combined with the following transaction manager bean declarations in the application context.

<tx:annotation-driven/>

    <bean id="transactionManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        ...
        <qualifier value="order"/>
    </bean>

    <bean id="transactionManager2" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        ...
        <qualifier value="account"/>
    </bean>

In this case, the two methods on TransactionalService will run under separate transaction managers, differentiated by the "order" and "account" qualifiers. The default <tx:annotation-driven> target bean name transactionManager will still be used if no specifically qualified PlatformTransactionManager bean is found.

 

참조 URL : https://www.lesstif.com/pages/viewpage.action?pageId=20774954

posted by 천상의날개
2015. 12. 4. 15:16 JAVA오픈소스/Spring

트렌젝션 사용자 커밋.
참고사항으로 @Transactional 어노테이션이 클레스에나 해당 메소드에 정의되어 있으면 에러남. 어짜고 저짜고 rollback-only

트랜젝션 메니져가 여러개면 마지막에 선언한 트렌젝션 부터 닫아야함 예) 시작 [a b]  commit이나 rollback [b a]

posted by 천상의날개
2015. 11. 18. 11:33 JAVA오픈소스/mybatis

--------------------------------------------------------------------------
{ call 
         begin .. 내용
}
--------------------------------------------------------------------------

--------------------------------------------------------------------------
declear
내용
;
--------------------------------------------------------------------------

begin은 "{ call }" 을 넣어줘야하고 declear로 선언은 "{call}"을 빼고 마지막에 ";" 문구를 넣어야함


 

'JAVA오픈소스 > mybatis' 카테고리의 다른 글

mybatis plugin 사용법(메뉴얼 sql 로깅)  (0) 2016.03.25
posted by 천상의날개