Interface TransactionManager


public interface TransactionManager
TransactionManager provides a centralized interface for all transaction related services. It contains methods to commit and rollback transactions.

The TransactionManager is accessed using EbaseSystem.getTransactionManager().

Since:
V4.4
  • Method Summary

    Modifier and Type Method Description
    void commitAndRestartTransaction()
    Commits the current transaction and starts a new transaction.
    int getDefaultTransactionTimeout()
    Returns the configured default transaction timeout value in seconds.
    void rollbackAndRestartTransaction()
    Rolls back the current transaction and starts a new transaction.
    void setDefaultTransactionTimeout​(int noSeconds)
    Sets the default transaction timeout value in seconds, which is applied to all new transactions started after this time.
  • Method Details

    • commitAndRestartTransaction

      void commitAndRestartTransaction() throws com.ebasetech.xi.exceptions.FormTransactionRuntimeException
      Commits the current transaction and starts a new transaction.

      All processing must be executed within a transactional environment and the system provides default behaviour to ensure this: a transaction is started automatically each time a post is received from the user, and the current transaction is automatically committed just before the output page is presented to the user.

      This method provides the opportunity to divide processing into a number of smaller transactions.

      Throws:
      com.ebasetech.xi.exceptions.FormTransactionRuntimeException - if any failure occurs
      Since:
      V4.4
      See Also:
      rollbackAndRestartTransaction()
    • rollbackAndRestartTransaction

      void rollbackAndRestartTransaction() throws com.ebasetech.xi.exceptions.FormTransactionRuntimeException
      Rolls back the current transaction and starts a new transaction.

      All processing must be executed within a transactional environment and the system provides default behaviour to ensure this: a transaction is started automatically each time a post is received from the user, and the current transaction is automatically committed just before the output page is presented to the user.

      Throws:
      com.ebasetech.xi.exceptions.FormTransactionRuntimeException - if any failure occurs
      Since:
      V4.4
      See Also:
      commitAndRestartTransaction()
    • getDefaultTransactionTimeout

      int getDefaultTransactionTimeout()
      Returns the configured default transaction timeout value in seconds.
      Returns:
      transaction timeout value in seconds
      Since:
      V4.4
    • setDefaultTransactionTimeout

      void setDefaultTransactionTimeout​(int noSeconds)
      Sets the default transaction timeout value in seconds, which is applied to all new transactions started after this time. Note that this method changes the timeout for all future transactions for all users.

      Example:

       var originalTimeoutValue = system.transactionManager.defaultTransactionTimeout;
       try {
          system.transactionManager.setDefaultTransactionTimeout(3600);
          // Start a new transaction with the new timeout value
          system.transactionManager.commitAndRestartTransaction();
          .. the rest of your code goes here
        }
        finally {
           system.transactionManager.setDefaultTransactionTimeout(originalTimeoutValue);
        }
       
      Parameters:
      noSeconds - number of seconds
      Since:
      V4.4