com.holonplatform.datastore.jpa.tx

## Interface JpaTransaction

- All Superinterfaces:
    com.holonplatform.core.datastore.transaction.Transaction, com.holonplatform.core.datastore.transaction.TransactionStatus

      public interface JpaTransaction
      extends com.holonplatform.core.datastore.transaction.Transaction

  JPA `Transaction`.
  Since:
    5.1.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.core.datastore.transaction.TransactionStatus

      `com.holonplatform.core.datastore.transaction.TransactionStatus.IllegalTransactionStatusException, com.holonplatform.core.datastore.transaction.TransactionStatus.TransactionException, com.holonplatform.core.datastore.transaction.TransactionStatus.TransactionNotSupportedException`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JpaTransaction` | `create(javax.persistence.EntityManager entityManager, com.holonplatform.core.datastore.transaction.TransactionConfiguration configuration)` Create a new `JpaTransaction`.
    `static JpaTransaction` | `delegate(JpaTransaction delegated)` Create a `JpaTransaction` which delegates its operations and status to the given delegated transaction.
    `void` | `end()` Finalize the transaction.
    `com.holonplatform.core.datastore.transaction.TransactionConfiguration` | `getConfiguration()` Get the transaction configuration.
    `javax.persistence.EntityManager` | `getEntityManager()` Get the `EntityManager` which owns the transaction.
    `void` | `start()` Start the transaction, configuring the connection.

    - ### Methods inherited from interface com.holonplatform.core.datastore.transaction.Transaction

      `commit, rollback`

    - ### Methods inherited from interface com.holonplatform.core.datastore.transaction.TransactionStatus

      `isActive, isCompleted, isNew, isRollbackOnly, setRollbackOnly`

- - ### Method Detail

    - #### start

          void start()
              throws com.holonplatform.core.datastore.transaction.TransactionStatus.TransactionException

      Start the transaction, configuring the connection.
      Throws:
        `TransactionException` - If an error occurred
        `com.holonplatform.core.datastore.transaction.TransactionStatus.TransactionException`

    - #### end

          void end()
            throws com.holonplatform.core.datastore.transaction.TransactionStatus.TransactionException

      Finalize the transaction.
      Throws:
        `TransactionException` - If an error occurred
        `com.holonplatform.core.datastore.transaction.TransactionStatus.TransactionException`

    - #### getEntityManager

          javax.persistence.EntityManager getEntityManager()

      Get the `EntityManager` which owns the transaction.
      Returns:
        The transaction `EntityManager`

    - #### getConfiguration

          com.holonplatform.core.datastore.transaction.TransactionConfiguration getConfiguration()

      Get the transaction configuration.
      Returns:
        the transaction configuration

    - #### create

          static JpaTransaction create(javax.persistence.EntityManager entityManager,
                                       com.holonplatform.core.datastore.transaction.TransactionConfiguration configuration)

      Create a new `JpaTransaction`.
      Parameters:
        `entityManager` - EntityManager (not null)
        `configuration` - Transaction configuration (not null)
      Returns:
        A new `JpaTransaction` implementation

    - #### delegate

          static JpaTransaction delegate(JpaTransaction delegated)

      Create a `JpaTransaction` which delegates its operations and status to the given delegated transaction.

      The delegated transaction returns `false` from the `TransactionStatus.isNew()` method.

      Parameters:
        `delegated` - Delegated transaction (not null)
      Returns:
        A delegated `JpaTransaction` implementation

Copyright © 2019 The Holon Platform. All rights reserved.