Overview
This document describes how to manage Spring+iBatis transactions.
How to manage
1. Bean Managed Transaction (BMT), explicit transaction management (how to consider transaction processing in the source)
1-1 When directly using DataSourceTransactionManager
1-2 When using TransactionTemplate
2. CMT (Container Managed Transaction), declarative transaction management (using a configuration file and reducing consideration for transaction processing in the source)
2-1 Method using <tx:advice> tag
2-2. Method using TransactionProxyFactoryBean tag
2-3 Method using the @Transactional annotation
Detailed description
Common application
applicationContext.xml
1-1. When using DataSourceTransactionManager directly
- Configuration file: There is no additional configuration.
- Commit and rollback are processed directly on the source.
SetAutoCommit(false) must be called in order to process as a transaction.
Note that setAutoCommit(false) must be called when selecting blobs.
1-2. When to use TransactionTemplate
Configuration file
- The user must use functions such as transactionTemplate.execute() and doInTransaction() on the source.
- Note that when selecting blobs, Oracle did not process transactions, but when using Altibase, the user must use functions such as transactionTemplate.execute() and doInTransaction() on the source to process transactions.
2-1. Method using <tx:advice> tag
Configuration file
- There is no need for transaction-related code on the source.
2-2. Method using TransactionProxyFactoryBean tag
Configuration file
- There is no need for transaction-related code on the source.
2-3 Method using the @Transactional annotation
Configuration
- Classes that require transactions on the source require @Transactional(propagation=Propagation.REQUIRED) notation.
Reference
- If AltibaseClobStringTypeHandler is applied guided by the standard framework, an error may occur when CLOB is 0 byte.
In this case, the user can check that it is normally searched by adding annotations without using TypeHandle.
Sample code
Sample code for handling LOB data.