public interface OfBizTransactionManager
To use:
withTransaction(Consumer)
or withTransaction(Function)
depending on whether a return value is neededOfBizTransaction.rollback()
inside the function passed inSimple usage example:
transactionManager.withTransaction(t -> { //... do database code inside transaction });You can also return a value and rollback in case of business logic errors:
int numUpdates = OfBizTransaction.withTransaction(t -> { //... database code });Or if business logic fails, the transaction can be rolled back:
transactionManager.withTransaction(t -> { //.. do some database code if (!businessLogicIsOk()) t.rollback(); });
Modifier and Type | Method and Description |
---|---|
void |
withTransaction(java.util.function.Consumer<? super OfBizTransaction> transactionUsingFunction) |
<R> R |
withTransaction(java.util.function.Function<? super OfBizTransaction,R> transactionUsingFunction) |
<R> R withTransaction(java.util.function.Function<? super OfBizTransaction,R> transactionUsingFunction)
void withTransaction(java.util.function.Consumer<? super OfBizTransaction> transactionUsingFunction)
Copyright © 2002-2015 Atlassian. All Rights Reserved.