# Interface CommitRequestOrBuilder (3.1.0)

3.1.0 (latest) 2.40.0 2.37.0 2.36.0 2.34.0 2.33.3 2.32.3 2.31.4 2.30.0 2.29.1 2.28.2 2.27.1 2.26.4 2.25.2 2.24.3 2.23.0 2.22.0 2.21.3 2.20.2 2.19.2 2.18.5 2.17.6

    public interface CommitRequestOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### getDatabaseId()

    public abstract String getDatabaseId()

The ID of the database against which to make the request.

'(default)' is not allowed; please use empty string '' to refer the default
database.

`string database_id = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The databaseId. |

### getDatabaseIdBytes()

    public abstract ByteString getDatabaseIdBytes()

The ID of the database against which to make the request.

'(default)' is not allowed; please use empty string '' to refer the default
database.

`string database_id = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for databaseId. |

### getMode()

    public abstract CommitRequest.Mode getMode()

The type of commit to perform. Defaults to `TRANSACTIONAL`.

`.google.datastore.v1.CommitRequest.Mode mode = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.CommitRequest.Mode` | The mode. |

### getModeValue()

    public abstract int getModeValue()

The type of commit to perform. Defaults to `TRANSACTIONAL`.

`.google.datastore.v1.CommitRequest.Mode mode = 5;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | The enum numeric value on the wire for mode. |

### getMutations(int index)

    public abstract Mutation getMutations(int index)

The mutations to perform.

When mode is `TRANSACTIONAL`, mutations affecting a single entity are
applied in order. The following sequences of mutations affecting a single
entity are not permitted in a single `Commit` request:

- `insert` followed by `insert`
- `update` followed by `insert`
- `upsert` followed by `insert`
- `delete` followed by `update`

  When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
  entity.

`repeated .google.datastore.v1.Mutation mutations = 6;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.Mutation` |   |

### getMutationsCount()

    public abstract int getMutationsCount()

The mutations to perform.

When mode is `TRANSACTIONAL`, mutations affecting a single entity are
applied in order. The following sequences of mutations affecting a single
entity are not permitted in a single `Commit` request:

- `insert` followed by `insert`
- `update` followed by `insert`
- `upsert` followed by `insert`
- `delete` followed by `update`

  When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
  entity.

`repeated .google.datastore.v1.Mutation mutations = 6;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getMutationsList()

    public abstract List<Mutation> getMutationsList()

The mutations to perform.

When mode is `TRANSACTIONAL`, mutations affecting a single entity are
applied in order. The following sequences of mutations affecting a single
entity are not permitted in a single `Commit` request:

- `insert` followed by `insert`
- `update` followed by `insert`
- `upsert` followed by `insert`
- `delete` followed by `update`

  When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
  entity.

`repeated .google.datastore.v1.Mutation mutations = 6;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.Mutation>` |   |

### getMutationsOrBuilder(int index)

    public abstract MutationOrBuilder getMutationsOrBuilder(int index)

The mutations to perform.

When mode is `TRANSACTIONAL`, mutations affecting a single entity are
applied in order. The following sequences of mutations affecting a single
entity are not permitted in a single `Commit` request:

- `insert` followed by `insert`
- `update` followed by `insert`
- `upsert` followed by `insert`
- `delete` followed by `update`

  When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
  entity.

`repeated .google.datastore.v1.Mutation mutations = 6;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.MutationOrBuilder` |   |

### getMutationsOrBuilderList()

    public abstract List<? extends MutationOrBuilder> getMutationsOrBuilderList()

The mutations to perform.

When mode is `TRANSACTIONAL`, mutations affecting a single entity are
applied in order. The following sequences of mutations affecting a single
entity are not permitted in a single `Commit` request:

- `insert` followed by `insert`
- `update` followed by `insert`
- `upsert` followed by `insert`
- `delete` followed by `update`

  When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
  entity.

`repeated .google.datastore.v1.Mutation mutations = 6;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<? extends com.google.datastore.v1.MutationOrBuilder>` |   |

### getProjectId()

    public abstract String getProjectId()

Required. The ID of the project against which to make the request.

`string project_id = 8 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The projectId. |

### getProjectIdBytes()

    public abstract ByteString getProjectIdBytes()

Required. The ID of the project against which to make the request.

`string project_id = 8 [(.google.api.field_behavior) = REQUIRED];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for projectId. |

### getSingleUseTransaction()

    public abstract TransactionOptions getSingleUseTransaction()

Options for beginning a new transaction for this request.
The transaction is committed when the request completes. If specified,
TransactionOptions.mode must be
TransactionOptions.ReadWrite.

`.google.datastore.v1.TransactionOptions single_use_transaction = 10;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.TransactionOptions` | The singleUseTransaction. |

### getSingleUseTransactionOrBuilder()

    public abstract TransactionOptionsOrBuilder getSingleUseTransactionOrBuilder()

Options for beginning a new transaction for this request.
The transaction is committed when the request completes. If specified,
TransactionOptions.mode must be
TransactionOptions.ReadWrite.

`.google.datastore.v1.TransactionOptions single_use_transaction = 10;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.TransactionOptionsOrBuilder` |   |

### getTransaction()

    public abstract ByteString getTransaction()

The identifier of the transaction associated with the commit. A
transaction identifier is returned by a call to
Datastore.BeginTransaction.

`bytes transaction = 1;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The transaction. |

### getTransactionSelectorCase()

    public abstract CommitRequest.TransactionSelectorCase getTransactionSelectorCase()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.CommitRequest.TransactionSelectorCase` |   |

### hasSingleUseTransaction()

    public abstract boolean hasSingleUseTransaction()

Options for beginning a new transaction for this request.
The transaction is committed when the request completes. If specified,
TransactionOptions.mode must be
TransactionOptions.ReadWrite.

`.google.datastore.v1.TransactionOptions single_use_transaction = 10;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the singleUseTransaction field is set. |

### hasTransaction()

    public abstract boolean hasTransaction()

The identifier of the transaction associated with the commit. A
transaction identifier is returned by a call to
Datastore.BeginTransaction.

`bytes transaction = 1;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the transaction field is set. |