public enum TransactionCloseStrategy extends Enum<TransactionCloseStrategy>
StrolchTransaction is closed. Strolch transactions are auto closeable which means
when used in a try-with-resource block, then they are automatically closed. Depending on the use case, these
transactions might write something to the DB, or only read the model, or even have to roll back, this is controlled
by using these enums.| Enum Constant and Description |
|---|
COMMIT
The main close strategy type where changes are written to the model.
|
DO_NOTHING
This is for read only transactions.
|
ROLLBACK
In exceptional cases one might not want any changes to be written to the model, thus calling
StrolchTransaction.rollbackOnClose() will have the transaction roll back all changes |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close(StrolchTransaction tx) |
abstract boolean |
isReadonly() |
static TransactionCloseStrategy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static TransactionCloseStrategy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final TransactionCloseStrategy DO_NOTHING
This is for read only transactions. If this strategy is used, then no changes will be written to the model. Use
StrolchTransaction.doNothingOnClose() to simply close the transaction, releasing any resources
Note: When using this strategy, then the transaction will throw exceptions if you try to add commands to the transaction.
public static final TransactionCloseStrategy COMMIT
StrolchTransaction.commitOnClose() to commit any changes i.e. commands added to the transactionpublic static final TransactionCloseStrategy ROLLBACK
StrolchTransaction.rollbackOnClose() will have the transaction roll back all changespublic static TransactionCloseStrategy[] values()
for (TransactionCloseStrategy c : TransactionCloseStrategy.values()) System.out.println(c);
public static TransactionCloseStrategy valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic abstract void close(StrolchTransaction tx) throws StrolchException
StrolchExceptionpublic abstract boolean isReadonly()
Copyright © 2011–2016 Strolch. All rights reserved.