com.google.appengine.api.datastore

## Class TransactionOptions

- java.lang.Object
- - com.google.appengine.api.datastore.TransactionOptions

-     public final class TransactionOptions
      extends java.lang.Object

  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 Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TransactionOptions.Builder` Contains static creation methods for `TransactionOptions`.
    `static class` | `TransactionOptions.Mode` The mode of the transaction.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Boolean` | `allowsMultipleEntityGroups()` Deprecated.
    `TransactionOptions` | `clearMultipleEntityGroups()` Deprecated.
    `TransactionOptions` | `clearXG()` Return the cross-group transaction setting to default (disabled).
    `boolean` | `equals(java.lang.Object o)`
    `int` | `hashCode()`
    `boolean` | `isXG()`
    `TransactionOptions` | `multipleEntityGroups(boolean enable)` Deprecated.
    `Transaction` | `previousTransaction()` Return the previous transaction that is being retried, or `null` if none was provided.
    `TransactionOptions` | `setPreviousTransaction(Transaction previousTransaction)` Set which previous transaction to retry.
    `TransactionOptions` | `setTransactionMode(TransactionOptions.Mode mode)` Set the mode of the transaction.
    `TransactionOptions` | `setXG(boolean enable)` Enable or disable the use of cross-group transactions.
    `java.lang.String` | `toString()`
    `TransactionOptions.Mode` | `transactionMode()` Return the mode of the transaction, or `null` if none was specified.

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### 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:
        `true` if cross-group transactions are allowed, `false` if 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 same `TransactionOptions`, with the exception of the `previousTransaction` property.

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

      Parameters:
        `previousTransaction` - the transaction to retry.

    - #### previousTransaction

          public Transaction previousTransaction()

      Return the previous transaction that is being retried, or `null` if 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 TransactionOptions.Mode transactionMode()

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

    - #### multipleEntityGroups

          @Deprecated
          public TransactionOptions multipleEntityGroups(boolean enable)

      Deprecated.
      See Also:
        `setXG(boolean)`

    - #### clearMultipleEntityGroups

          @Deprecated
          public TransactionOptions clearMultipleEntityGroups()

      Deprecated.
      See Also:
        `clearXG()`

    - #### allowsMultipleEntityGroups

          @Deprecated
          public java.lang.Boolean allowsMultipleEntityGroups()

      Deprecated.
      See Also:
        `isXG()`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`