org.springframework.transaction
Interface PlatformTransactionManager

All Known Implementing Classes:
AbstractPlatformTransactionManager

public interface PlatformTransactionManager

This is the central interface in Spring's transaction support. Applications can use this directly, but it is not primarily meant as API. Typically, applications will work with either TransactionTemplate or the AOP transaction interceptor.

For implementers, AbstractPlatformTransactionManager is a good starting point. The default implementations are DataSourceTransactionManager and JtaTransactionManager.

Since:
16-Mar-2003
Version:
$Revision: 1.2 $
Author:
Rod Johnson, Juergen Hoeller
See Also:
TransactionTemplate, TransactionInterceptor, AbstractPlatformTransactionManager, DataSourceTransactionManager, JtaTransactionManager

Method Summary
 void commit(TransactionStatus status)
          Commit the given transaction, with regard to its status.
 TransactionStatus getTransaction(TransactionDefinition definition)
          Return a currently active transaction or create a new one.
 void rollback(TransactionStatus status)
          Roll back the given transaction, with regard to its status.
 

Method Detail

getTransaction

public TransactionStatus getTransaction(TransactionDefinition definition)
                                 throws TransactionException
Return a currently active transaction or create a new one. Note that parameters like isolation level or timeout will only be applied to new transactions, and thus be ignored when participating in active ones. Furthermore, they aren't supported by every transaction manager: A proper implementation should thrown an exception when custom values that it doesn't support are specified.

Parameters:
definition - TransactionDefinition instance (can be null for defaults), describing propagation behavior, isolation level, timeout etc.
Returns:
transaction status object representing the new or current transaction
Throws:
TransactionException - in case of lookup, creation, or system errors

commit

public void commit(TransactionStatus status)
            throws TransactionException
Commit the given transaction, with regard to its status. If the transaction has been marked rollback-only programmatically, perform a rollback. If the transaction wasn't a new one, omit the commit to take part in the surrounding transaction properly.

Parameters:
status - object returned by the getTransaction() method.
Throws:
TransactionException - in case of commit or system errors

rollback

public void rollback(TransactionStatus status)
              throws TransactionException
Roll back the given transaction, with regard to its status. If the transaction wasn't a new one, just set it rollback-only to take part in the surrounding transaction properly.

Parameters:
status - object returned by the getTransaction() method.
Throws:
TransactionException - in case of system errors


Copyright (C) 2003-2004 The Spring Framework Project.