Class TransactionOptions
java.lang.Object
com.google.appengine.api.datastore.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
TransactionOptions.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 ClassesModifier and TypeClassDescriptionstatic final class
Contains static creation methods forTransactionOptions
.static enum
The mode of the transaction. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Deprecated.UseclearXG()
instead.clearXG()
Return the cross-group transaction setting to default (disabled).boolean
int
hashCode()
boolean
isXG()
multipleEntityGroups
(boolean enable) Deprecated.UsesetXG(boolean)
instead.@Nullable Transaction
Return the previous transaction that is being retried, ornull
if none was provided.setPreviousTransaction
(Transaction previousTransaction) Set which previous transaction to retry.Set the mode of the transaction.setXG
(boolean enable) Enable or disable the use of cross-group transactions.toString()
@Nullable TransactionOptions.Mode
Return the mode of the transaction, ornull
if none was specified.
-
Method Details
-
setXG
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
Return the cross-group transaction setting to default (disabled). -
isXG
public boolean isXG()- Returns:
true
if cross-group transactions are allowed,false
if they are not allowed.
-
setPreviousTransaction
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 thepreviousTransaction
property.A rollback is not required, and should not be performed, prior to retrying the transaction.
- Parameters:
previousTransaction
- the transaction to retry.
-
previousTransaction
Return the previous transaction that is being retried, ornull
if none was provided. -
setTransactionMode
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
Return the mode of the transaction, ornull
if none was specified. -
multipleEntityGroups
Deprecated.UsesetXG(boolean)
instead.SeesetXG(boolean)
. -
clearMultipleEntityGroups
Deprecated.UseclearXG()
instead.SeeclearXG()
. -
allowsMultipleEntityGroups
Deprecated.UseisXG()
instead.SeeisXG()
. -
equals
-
hashCode
public int hashCode() -
toString
-
isXG()
instead.