Interface TxSupport


public interface TxSupport
Implemented by each transaction handling support.

It is Helidon Service interface with io.helidon.common.Weight specified. Default JTA implementation module with io.helidon.common.Weighted.DEFAULT_WEIGHT weight and "jta" type() is available as part of Helidon Transaction modules set. Helidon Data Jakarta Persistence module provides its own RESOURCE-LOCAL implementation with "resource-local" type() as a fallback option when JTA is not present.

  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    transaction(Tx.Type type, Callable<T> task)
    Execute provided task as database transaction.
    Type of the transaction API support, e.g.
  • Method Details

    • type

      String type()
      Type of the transaction API support, e.g. "jta", "resource-local". Never returns null.
      Returns:
      the transaction API support
    • transaction

      <T> T transaction(Tx.Type type, Callable<T> task)
      Execute provided task as database transaction. Transaction is handled automatically. Task computes and returns result.
      Type Parameters:
      T - the result type of the task
      Parameters:
      type - transaction type, shall not be null
      task - task to run in transaction, shall not be null
      Returns:
      computed task result
      Throws:
      TxException - when result computation failed