Interface CallbackPreferringPlatformTransactionManager
- All Superinterfaces:
 PlatformTransactionManager,TransactionManager
- All Known Implementing Classes:
 WebSphereUowTransactionManager
public interface CallbackPreferringPlatformTransactionManager extends PlatformTransactionManager
Extension of thePlatformTransactionManagerinterface, exposing a method for executing a given callback within a transaction.Implementors of this interface automatically express a preference for callbacks over programmatic
getTransaction,commitandrollbackcalls. 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
TransactionTemplateandTransactionInterceptordetect and use this PlatformTransactionManager variant automatically.- Since:
 - 2.0
 - Author:
 - Juergen Hoeller
 - See Also:
 TransactionTemplate,TransactionInterceptor
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Texecute(TransactionDefinition definition, TransactionCallback<T> callback)Execute the action specified by the given callback object within a transaction.Methods inherited from interface org.springframework.transaction.PlatformTransactionManager
commit, getTransaction, rollback
Method Detail
execute
@Nullable <T> T execute(@Nullable 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.
- Parameters:
 definition- the definition for the transaction to wrap the callback incallback- the callback object that specifies the transactional action- Returns:
 - a result object returned by the callback, or 
nullif none - Throws:
 TransactionException- in case of initialization, rollback, or system errorsRuntimeException- if thrown by the TransactionCallback