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 TypeMethodDescription<T> T
transaction
(Tx.Type type, Callable<T> task) Execute provided task as database transaction.type()
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 returnsnull
.- Returns:
- the transaction API support
-
transaction
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 benull
task
- task to run in transaction, shall not benull
- Returns:
- computed task result
- Throws:
TxException
- when result computation failed
-