public interface TransactionManager
|Modifier and Type||Method and Description|
Executes the given
Invokes the given
Starts a transaction.
default void executeInTransaction(Runnable task)
taskin a new
Transaction. The transaction is committed when the task completes normally, and rolled back when it throws an exception.
task- The task to execute
default <T> T fetchInTransaction(Supplier<T> supplier)
supplierin a transaction managed by the current TransactionManager. Upon completion of the call, the transaction will be committed in the case of a regular return value, or rolled back in case an exception occurred.
This method is an alternative to
executeInTransaction(Runnable) in cases where a result needs to be
returned from the code to be executed transactionally.
T- The type of value to return
supplier- The supplier of the value to return
Copyright © 2010–2023. All rights reserved.