com.holonplatform.core.datastore.transaction

## Interface TransactionConfiguration

-     public interface TransactionConfiguration

  `Transaction` configuration.
  Since:
    5.1.0

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TransactionConfiguration` | `create(boolean rollbackOnError, boolean autoCommit)` Create a `TransactionConfiguration`.
    `static TransactionConfiguration` | `create(boolean rollbackOnError, boolean autoCommit, TransactionOptions transactionOptions)` Create a `TransactionConfiguration`.
    `static TransactionConfiguration` | `create(TransactionOptions transactionOptions)` Create a `TransactionConfiguration`.
    `static TransactionConfiguration` | `getDefault()` Create a default `TransactionConfiguration` setting transaction rollback on errors to `true`.
    `Optional<TransactionOptions>` | `getTransactionOptions()` Get the transaction configuration options, if any.
    `boolean` | `isAutoCommit()` Gets whether the transaction must be committed when a transactional operation ends and no error occurred.
    `boolean` | `isRollbackOnError()` Gets whether the transaction must be rolled back when an exception is thrown during a transactional operation execution.
    `static TransactionConfiguration` | `withAutoCommit()` Create a `TransactionConfiguration` setting transaction auto-commit to `true`.

- - ### Method Detail

    - #### isRollbackOnError

          boolean isRollbackOnError()

      Gets whether the transaction must be rolled back when an exception is thrown during a transactional operation execution.

      Default is `true`.

      Returns:
        `true` if the transaction must be rolled back when an exception is thrown during a transactional operation execution, `false` otherwise

    - #### isAutoCommit

          boolean isAutoCommit()

      Gets whether the transaction must be committed when a transactional operation ends and no error occurred.

      Default is `false`.

      Returns:
        `true` to commit the transaction when a transactional operation ends

    - #### getTransactionOptions

          Optional<TransactionOptions> getTransactionOptions()

      Get the transaction configuration options, if any.
      Returns:
        Optional transaction configuration options

    - #### getDefault

          static TransactionConfiguration getDefault()

      Create a default `TransactionConfiguration` setting transaction rollback on errors to `true`.
      Returns:
        A a default `TransactionConfiguration`

    - #### withAutoCommit

          static TransactionConfiguration withAutoCommit()

      Create a `TransactionConfiguration` setting transaction auto-commit to `true`.
      Returns:
        A new transaction configuration
      See Also:
        `isAutoCommit()`

    - #### create

          static TransactionConfiguration create(boolean rollbackOnError,
                                                 boolean autoCommit)

      Create a `TransactionConfiguration`.
      Parameters:
        `rollbackOnError` - Whether the transaction must be rolled back when an exception is thrown during a transactional operation execution.
        `autoCommit` - whether the transaction must be committed when a transactional operation ends and no error occurred
      Returns:
        A new transaction configuration

    - #### create

          static TransactionConfiguration create(TransactionOptions transactionOptions)

      Create a `TransactionConfiguration`.
      Parameters:
        `transactionOptions` - The transation configuration options
      Returns:
        A new transaction configuration

    - #### create

          static TransactionConfiguration create(boolean rollbackOnError,
                                                 boolean autoCommit,
                                                 TransactionOptions transactionOptions)

      Create a `TransactionConfiguration`.
      Parameters:
        `rollbackOnError` - Whether the transaction must be rolled back when an exception is thrown during a transactional operation execution.
        `autoCommit` - whether the transaction must be committed when a transactional operation ends and no error occurred
        `transactionOptions` - The transation configuration options
      Returns:
        A new transaction configuration

Copyright © 2019 The Holon Platform. All rights reserved.