Class TransactionOptions (2.0.0)

public final class TransactionOptions

Describes options for transactions, passed at transaction creation time.

Notes on usage:
The recommended way to instantiate a TransactionsOptions object is to statically import 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));
 

Inheritance

java.lang.Object > TransactionOptions

Methods

allowsMultipleEntityGroups() (deprecated)

public Boolean allowsMultipleEntityGroups()

Deprecated. Use #isXG() instead.

See #isXG.

Returns
TypeDescription
Boolean

clearMultipleEntityGroups() (deprecated)

public TransactionOptions clearMultipleEntityGroups()

Deprecated. Use #clearXG() instead.

See #clearXG.

Returns
TypeDescription
TransactionOptions

clearXG()

public TransactionOptions clearXG()

Return the cross-group transaction setting to default (disabled).

Returns
TypeDescription
TransactionOptions

equals(@Nullable Object o)

public boolean equals(@Nullable Object o)
Parameter
NameDescription
o@org.checkerframework.checker.nullness.qual.Nullable java.lang.Object
Returns
TypeDescription
boolean
Overrides

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

isXG()

public boolean isXG()
Returns
TypeDescription
boolean

true if cross-group transactions are allowed, false if they are not allowed.

multipleEntityGroups(boolean enable) (deprecated)

public TransactionOptions multipleEntityGroups(boolean enable)

Deprecated. Use setXG(boolean) instead.

See #setXG.

Parameter
NameDescription
enableboolean
Returns
TypeDescription
TransactionOptions

previousTransaction()

public @Nullable Transaction previousTransaction()

Return the previous transaction that is being retried, or null if none was provided.

Returns
TypeDescription
@org.checkerframework.checker.nullness.qual.Nullable com.google.appengine.api.datastore.Transaction

setPreviousTransaction(Transaction previousTransaction)

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 same TransactionOptions, with the exception of the previousTransaction property.

A rollback is not required, and should not be performed, prior to retrying the transaction.

Parameter
NameDescription
previousTransactionTransaction

the transaction to retry.

Returns
TypeDescription
TransactionOptions

setTransactionMode(TransactionOptions.Mode mode)

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.

Parameter
NameDescription
modeTransactionOptions.Mode
Returns
TypeDescription
TransactionOptions

setXG(boolean enable)

public TransactionOptions setXG(boolean enable)

Enable or disable the use of cross-group transactions.

Parameter
NameDescription
enableboolean

true to cross-group transactions, false to restrict transactions to a single entity group.

Returns
TypeDescription
TransactionOptions

this (for chaining)

toString()

public String toString()
Returns
TypeDescription
String
Overrides

transactionMode()

public @Nullable TransactionOptions.Mode transactionMode()

Return the mode of the transaction, or null if none was specified.

Returns
TypeDescription
@org.checkerframework.checker.nullness.qual.Nullable com.google.appengine.api.datastore.TransactionOptions.Mode