Class SpringTransactionManager

java.lang.Object
org.axonframework.spring.messaging.unitofwork.SpringTransactionManager
All Implemented Interfaces:
TransactionManager

public class SpringTransactionManager extends Object implements TransactionManager
TransactionManager implementation that uses a PlatformTransactionManager as underlying transaction manager.
Since:
2.0
Author:
Allard Buijze
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpringTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
    Initializes the SpringTransactionManager with the given transactionManager and the default transaction definition.
    SpringTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager, org.springframework.transaction.TransactionDefinition transactionDefinition)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    commitTransaction(org.springframework.transaction.TransactionStatus status)
    Commits the transaction with given status if the transaction is new and not completed.
    protected void
    rollbackTransaction(org.springframework.transaction.TransactionStatus status)
    Rolls back the transaction with given status if the transaction is new and not completed.
    Starts a transaction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.axonframework.common.transaction.TransactionManager

    executeInTransaction, fetchInTransaction
  • Constructor Details

    • SpringTransactionManager

      public SpringTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager, org.springframework.transaction.TransactionDefinition transactionDefinition)
      Parameters:
      transactionManager - The transaction manager to use
      transactionDefinition - The definition for transactions to create
    • SpringTransactionManager

      public SpringTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
      Initializes the SpringTransactionManager with the given transactionManager and the default transaction definition.
      Parameters:
      transactionManager - the transaction manager to use
  • Method Details

    • startTransaction

      @Nonnull public Transaction startTransaction()
      Description copied from interface: TransactionManager
      Starts a transaction. The return value is the started transaction that can be committed or rolled back.
      Specified by:
      startTransaction in interface TransactionManager
      Returns:
      The object representing the transaction
    • commitTransaction

      protected void commitTransaction(org.springframework.transaction.TransactionStatus status)
      Commits the transaction with given status if the transaction is new and not completed.
      Parameters:
      status - The status of the transaction to commit
    • rollbackTransaction

      protected void rollbackTransaction(org.springframework.transaction.TransactionStatus status)
      Rolls back the transaction with given status if the transaction is new and not completed.
      Parameters:
      status - The status of the transaction to roll back