# Interface Transaction (5.0.3)

    public interface Transaction

Describes a logical unit of work to be performed against the datastore. Operations performed as
part of a single [Transaction](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Transaction) succeed or fail as a unit. Transactions can be committed and
rolled back synchronously and asynchronously.

## Methods

### commit()

    public abstract void commit()

Commits the transaction. Whether this call succeeds or fails, all subsequent method invocations
on this object will throw IllegalStateException.

### commitAsync()

    public abstract Future<Void> commitAsync()

An asynchronous implementation of [#commit()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Transaction#com_google_appengine_api_datastore_Transaction_commit__).
See Also: [#commit()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Transaction#com_google_appengine_api_datastore_Transaction_commit__)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html<https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html>` | A Future associated with the call. |

### getApp()

    public abstract String getApp()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The application id for the `Transaction`. |

### getId()

    public abstract String getId()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The globally unique identifier for the `Transaction`. |

### isActive()

    public abstract boolean isActive()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | `true` if the transaction is active, `false` otherwise. |

### rollback()

    public abstract void rollback()

Rolls back the transaction. Whether this call succeeds or fails, all subsequent method
invocations on this object will throw IllegalStateException.

### rollbackAsync()

    public abstract Future<Void> rollbackAsync()

An asynchronous implementation of [#rollback()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Transaction#com_google_appengine_api_datastore_Transaction_rollback__).
See Also: [#rollback()](https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.datastore.Transaction#com_google_appengine_api_datastore_Transaction_rollback__)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html<https://docs.oracle.com/javase/8/docs/api/java/lang/Void.html>` | A Future associated with the call. |