Class SimpleTransactionStatus
- All Implemented Interfaces:
- Flushable, SavepointManager, TransactionExecution, TransactionStatus
TransactionStatus
implementation. Derives from AbstractTransactionStatus and
adds an explicit "newTransaction" flag.
This class is not used by any of Spring's pre-built
PlatformTransactionManager
implementations. It is mainly provided as a start for custom transaction
manager implementations and as a static mock for testing transactional
code (either as part of a mock PlatformTransactionManager or
as argument passed into a TransactionCallback to be tested).
- Since:
- 1.2.3
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a newSimpleTransactionStatusinstance, indicating a new transaction.SimpleTransactionStatus(boolean newTransaction) Create a newSimpleTransactionStatusinstance.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturn whether the transaction manager considers the present transaction as new; otherwise participating in an existing transaction, or potentially not running in an actual transaction in the first place.Methods inherited from class AbstractTransactionStatuscreateAndHoldSavepoint, createSavepoint, getSavepoint, getSavepointManager, hasSavepoint, isCompleted, isGlobalRollbackOnly, isLocalRollbackOnly, isRollbackOnly, releaseHeldSavepoint, releaseSavepoint, rollbackToHeldSavepoint, rollbackToSavepoint, setCompleted, setRollbackOnly, setSavepointMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface TransactionExecutiongetTransactionName, hasTransaction, isNested, isReadOnlyMethods inherited from interface TransactionStatusflush
- 
Constructor Details- 
SimpleTransactionStatuspublic SimpleTransactionStatus()Create a newSimpleTransactionStatusinstance, indicating a new transaction.
- 
SimpleTransactionStatuspublic SimpleTransactionStatus(boolean newTransaction) Create a newSimpleTransactionStatusinstance.- Parameters:
- newTransaction- whether to indicate a new transaction
 
 
- 
- 
Method Details- 
isNewTransactionpublic boolean isNewTransaction()Description copied from interface:TransactionExecutionReturn whether the transaction manager considers the present transaction as new; otherwise participating in an existing transaction, or potentially not running in an actual transaction in the first place.This is primarily here for transaction manager state handling. Prefer the use of TransactionExecution.hasTransaction()for application purposes since this is usually semantically appropriate.The "new" status can be transaction manager specific, for example, returning truefor an actual nested transaction but potentiallyfalsefor a savepoint-based nested transaction scope if the savepoint management is explicitly exposed (such as onTransactionStatus). A combined check for any kind of nested execution is provided byTransactionExecution.isNested().The default implementation returns true.- See Also:
 
 
-