Class TransactionOptions
- java.lang.Object
-
- com.google.appengine.api.datastore.TransactionOptions
-
public final class TransactionOptions extends Object
Describes options for transactions, passed at transaction creation time.Notes on usage:
The recommended way to instantiate aTransactionsOptionsobject is to statically importTransactionOptions.Builder.* and invoke a static creation method followed by an instance mutator (if needed):import static com.google.appengine.api.datastore.TransactionOptions.Builder.*; ... datastoreService.beginTransaction(withXG(true));
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTransactionOptions.BuilderContains static creation methods forTransactionOptions.static classTransactionOptions.ModeThe mode of the transaction.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description BooleanallowsMultipleEntityGroups()Deprecated.UseisXG()instead.TransactionOptionsclearMultipleEntityGroups()Deprecated.UseclearXG()instead.TransactionOptionsclearXG()Return the cross-group transaction setting to default (disabled).booleanequals(@Nullable Object o)inthashCode()booleanisXG()TransactionOptionsmultipleEntityGroups(boolean enable)Deprecated.UsesetXG(boolean)instead.@Nullable TransactionpreviousTransaction()Return the previous transaction that is being retried, ornullif none was provided.TransactionOptionssetPreviousTransaction(Transaction previousTransaction)Set which previous transaction to retry.TransactionOptionssetTransactionMode(TransactionOptions.Mode mode)Set the mode of the transaction.TransactionOptionssetXG(boolean enable)Enable or disable the use of cross-group transactions.StringtoString()@Nullable TransactionOptions.ModetransactionMode()Return the mode of the transaction, ornullif none was specified.
-
-
-
Method Detail
-
setXG
public TransactionOptions setXG(boolean enable)
Enable or disable the use of cross-group transactions.- Parameters:
enable- true to cross-group transactions, false to restrict transactions to a single entity group.- Returns:
this(for chaining)
-
clearXG
public TransactionOptions clearXG()
Return the cross-group transaction setting to default (disabled).
-
isXG
public boolean isXG()
- Returns:
trueif cross-group transactions are allowed,falseif they are not allowed.
-
setPreviousTransaction
public TransactionOptions setPreviousTransaction(Transaction previousTransaction)
Set which previous transaction to retry. Can only be used for READ_WRITE transactions. The previous transaction should have been created with the sameTransactionOptions, with the exception of thepreviousTransactionproperty.A rollback is not required, and should not be performed, prior to retrying the transaction.
- Parameters:
previousTransaction- the transaction to retry.
-
previousTransaction
public @Nullable Transaction previousTransaction()
Return the previous transaction that is being retried, ornullif none was provided.
-
setTransactionMode
public TransactionOptions setTransactionMode(TransactionOptions.Mode mode)
Set the mode of the transaction.Specifying the mode of the transaction can help to improve throughput, as it provides additional information about the intent (or lack of intent, in the case of read only transaction) to perform a write as part of the transaction.
-
transactionMode
public @Nullable TransactionOptions.Mode transactionMode()
Return the mode of the transaction, ornullif none was specified.
-
multipleEntityGroups
@Deprecated public TransactionOptions multipleEntityGroups(boolean enable)
Deprecated.UsesetXG(boolean)instead.SeesetXG(boolean).
-
clearMultipleEntityGroups
@Deprecated public TransactionOptions clearMultipleEntityGroups()
Deprecated.UseclearXG()instead.SeeclearXG().
-
allowsMultipleEntityGroups
@Deprecated public Boolean allowsMultipleEntityGroups()
Deprecated.UseisXG()instead.SeeisXG().
-
-