接口 CallbackPreferringPlatformTransactionManager
- 所有超级接口:
PlatformTransactionManager
- 所有已知实现类:
WebSphereUowTransactionManager
public interface CallbackPreferringPlatformTransactionManager extends PlatformTransactionManager
Extension of thePlatformTransactionManager
interface, exposing a method for executing a given callback within a transaction.Implementors of this interface automatically express a preference for callbacks over programmatic
getTransaction
,commit
androllback
calls. Calling code may check whether a given transaction manager implements this interface to choose to prepare a callback instead of explicit transaction demarcation control.Spring's
TransactionTemplate
andTransactionInterceptor
detect and use this PlatformTransactionManager variant automatically.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller
- 另请参阅:
TransactionTemplate
,TransactionInterceptor
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 <T> T
execute(TransactionDefinition definition, TransactionCallback<T> callback)
Execute the action specified by the given callback object within a transaction.从接口继承的方法 org.springframework.transaction.PlatformTransactionManager
commit, getTransaction, rollback
方法详细资料
execute
<T> T execute(TransactionDefinition definition, TransactionCallback<T> callback) throws TransactionException
Execute the action specified by the given callback object within a transaction.Allows for returning a result object created within the transaction, that is, a domain object or a collection of domain objects. A RuntimeException thrown by the callback is treated as a fatal exception that enforces a rollback. Such an exception gets propagated to the caller of the template.
- 参数:
definition
- the definition for the transaction to wrap the callback incallback
- the callback object that specifies the transactional action- 返回:
- a result object returned by the callback, or
null
if none - 抛出:
TransactionException
- in case of initialization, rollback, or system errorsRuntimeException
- if thrown by the TransactionCallback