Interface IJpaTransaction

  • All Superinterfaces:
    AutoCloseable, Closeable
    All Known Implementing Classes:
    JpaTransaction

    public interface IJpaTransaction
    extends Closeable
    Common interface representing a JPA transaction context, which encapsulates a single JPA entity transaction. This interface provides methods to manage the transaction lifecycle, including committing and rolling back transactions.

    Note: Transactions need be set to be committed on close explicitly by calling commit(). Otherwise, the transaction will be rolled back automatically when the context is closed.

    This interface extends Closeable to allow for automatic resource management, ensuring that the transaction is properly closed and resources are released.

    Note: This interface is designed for internal use only. Plugins should not use this interface. This interface may be moved to a different package in the future, so plugins should not depend on it.

    Since:
    8.5.0
    Author:
    Norman Lorenz
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Closes the JPA transaction context, committing the JPA transaction if set to do so.
      void commit()
      Marks the transaction to be committed when the transaction context is closed.
      javax.persistence.EntityManager em()
      Returns the JPA EntityManager associated with this transaction context.
      boolean isCommit()
      Checks if the transaction is marked to be committed when it is closed.
      void rollback()
      Marks the transaction to be rolled back when the transaction context is closed.
    • Method Detail

      • commit

        void commit()
        Marks the transaction to be committed when the transaction context is closed.
        See Also:
        close()
      • em

        javax.persistence.EntityManager em()
        Returns the JPA EntityManager associated with this transaction context.
        Returns:
        the EntityManager
      • isCommit

        boolean isCommit()
        Checks if the transaction is marked to be committed when it is closed.
        Returns:
        true if the transaction is set to be committed, false otherwise
        See Also:
        commit(), rollback()
      • rollback

        void rollback()
        Marks the transaction to be rolled back when the transaction context is closed.
        See Also:
        close()