Class GlueDataSourceTransactionManager
java.lang.Object
org.springframework.transaction.support.AbstractPlatformTransactionManager
org.springframework.jdbc.datasource.DataSourceTransactionManager
com.poscoict.glueframework.transaction.GlueDataSourceTransactionManager
- All Implemented Interfaces:
GlueTransactionManager
,Serializable
,InitializingBean
,ConfigurableTransactionManager
,PlatformTransactionManager
,ResourceTransactionManager
,TransactionManager
- Direct Known Subclasses:
GlueLazyDataSourceTransactionManager
public class GlueDataSourceTransactionManager
extends DataSourceTransactionManager
implements GlueTransactionManager
Data Source의 트랜잭션을 관리하는 Manager 클래스이다. 내부적으로 Spring Framework에서 제공하는 DataSourceTransactionManager를 상속받는다.
Bean Property
- dataSource : (필수)
- transactionDefinition : (선택)
예제
사용 예# 1
<bean id="tx" class="com.poscoict.glueframework.transaction.GlueDataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
사용 예# 2
- Transaction Definition 추가
<bean id="tx" class="com.poscoict.glueframework.transaction.GlueDataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
<property name="transactionDefinition" ref="txDef"/>
</bean>
<!-- Transaction Definition -->
<bean id="txDef" class="com.poscoict.glueframework.transaction.GlueDefaultTransactionDefinition">
<property name="isolationLevelName" value="ISOLATION_DEFAULT"/>
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRES_NEW"/>
<property name="readOnly" value="false"/>
<property name="timeout" value="100"/>
</bean>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
AbstractPlatformTransactionManager.SuspendedResourcesHolder
-
Field Summary
Fields inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
SYNCHRONIZATION_ALWAYS, SYNCHRONIZATION_NEVER, SYNCHRONIZATION_ON_ACTUAL_TRANSACTION
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.springframework.jdbc.datasource.DataSourceTransactionManager
doBegin, doCleanupAfterCompletion, doCommit, doGetTransaction, doResume, doRollback, doSetRollbackOnly, doSuspend, getDataSource, getResourceFactory, isEnforceReadOnly, isExistingTransaction, obtainDataSource, prepareTransactionalConnection, setDataSource, setEnforceReadOnly, translateException
Methods inherited from class org.springframework.transaction.support.AbstractPlatformTransactionManager
commit, determineTimeout, getDefaultTimeout, getTransaction, getTransactionExecutionListeners, getTransactionSynchronization, invokeAfterCompletion, isFailEarlyOnGlobalRollbackOnly, isGlobalRollbackOnParticipationFailure, isNestedTransactionAllowed, isRollbackOnCommitFailure, isValidateExistingTransaction, prepareForCommit, prepareSynchronization, registerAfterCompletionWithExistingTransaction, resume, rollback, setDefaultTimeout, setFailEarlyOnGlobalRollbackOnly, setGlobalRollbackOnParticipationFailure, setNestedTransactionAllowed, setRollbackOnCommitFailure, setTransactionExecutionListeners, setTransactionSynchronization, setTransactionSynchronizationName, setValidateExistingTransaction, shouldCommitOnGlobalRollbackOnly, suspend, triggerBeforeCommit, triggerBeforeCompletion, useSavepointForNestedTransaction
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.transaction.ConfigurableTransactionManager
addListener
Methods inherited from interface org.springframework.transaction.PlatformTransactionManager
commit, getTransaction, rollback
-
Constructor Details
-
GlueDataSourceTransactionManager
public GlueDataSourceTransactionManager()
-
-
Method Details
-
setTransactionDefinition
setter method for DI. Transaction Definition을 설정한다.- Parameters:
def
- Transaction Definition
-
startTransaction
Description copied from interface:GlueTransactionManager
트랜잭션을 시작한다. 명시적으로startTransaction
메소드를 호출하지 않으면 트랜잭션이 작동하지 않는다.- Specified by:
startTransaction
in interfaceGlueTransactionManager
- Throws:
GlueException
- 트랜잭션 시작 실패 시
-
commit
Description copied from interface:GlueTransactionManager
트랜잭션을 커밋한다. 커밋 수행 후 새로운 트랜잭션을 시작하기 위해서는startThreadLocalTransaction
메소드를 호출해 주어야 한다.- Specified by:
commit
in interfaceGlueTransactionManager
- Returns:
- 성공하면 true
- Throws:
GlueException
- 트랜잭션 커밋 실패 시
-
rollback
Description copied from interface:GlueTransactionManager
트랜잭션을 롤백한다. 롤백 수행 후 새로운 트랜잭션을 시작하기 위해서는startThreadLocalTransaction
메소드를 호출해 주어야 한다.- Specified by:
rollback
in interfaceGlueTransactionManager
- Returns:
- 성공하면 true
- Throws:
GlueException
- 트랜잭션을 롤백 실패 시
-
changeTransaction
ThreadLocal의 Transaction Status를 교체한다- Specified by:
changeTransaction
in interfaceGlueTransactionManager
- Parameters:
ts
- 새롭게 ThreadLocal에 설정할 TransactionStatus- Returns:
- TransactionStatus 기존에 사용하고 있던 TransactionStatus
- Throws:
GlueException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classDataSourceTransactionManager
-