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.
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.
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.
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.
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.
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.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Interface CommitRequestOrBuilder (2.31.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.31.2 (latest)](/java/docs/reference/google-cloud-datastore/latest/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.31.1](/java/docs/reference/google-cloud-datastore/2.31.1/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.30.0](/java/docs/reference/google-cloud-datastore/2.30.0/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.29.1](/java/docs/reference/google-cloud-datastore/2.29.1/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.28.2](/java/docs/reference/google-cloud-datastore/2.28.2/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.27.1](/java/docs/reference/google-cloud-datastore/2.27.1/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.26.4](/java/docs/reference/google-cloud-datastore/2.26.4/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.25.2](/java/docs/reference/google-cloud-datastore/2.25.2/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.24.3](/java/docs/reference/google-cloud-datastore/2.24.3/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.23.0](/java/docs/reference/google-cloud-datastore/2.23.0/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.22.0](/java/docs/reference/google-cloud-datastore/2.22.0/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.21.3](/java/docs/reference/google-cloud-datastore/2.21.3/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.20.2](/java/docs/reference/google-cloud-datastore/2.20.2/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.19.2](/java/docs/reference/google-cloud-datastore/2.19.2/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.18.5](/java/docs/reference/google-cloud-datastore/2.18.5/com.google.datastore.v1.CommitRequestOrBuilder)\n- [2.17.6](/java/docs/reference/google-cloud-datastore/2.17.6/com.google.datastore.v1.CommitRequestOrBuilder) \n\n public interface CommitRequestOrBuilder extends MessageOrBuilder\n\nImplements\n----------\n\n[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)\n\nMethods\n-------\n\n### getDatabaseId()\n\n public abstract String getDatabaseId()\n\nThe ID of the database against which to make the request.\n\n'(default)' is not allowed; please use empty string '' to refer the default\ndatabase.\n\n`string database_id = 9;`\n\n### getDatabaseIdBytes()\n\n public abstract ByteString getDatabaseIdBytes()\n\nThe ID of the database against which to make the request.\n\n'(default)' is not allowed; please use empty string '' to refer the default\ndatabase.\n\n`string database_id = 9;`\n\n### getMode()\n\n public abstract CommitRequest.Mode getMode()\n\nThe type of commit to perform. Defaults to `TRANSACTIONAL`.\n\n`.google.datastore.v1.CommitRequest.Mode mode = 5;`\n\n### getModeValue()\n\n public abstract int getModeValue()\n\nThe type of commit to perform. Defaults to `TRANSACTIONAL`.\n\n`.google.datastore.v1.CommitRequest.Mode mode = 5;`\n\n### getMutations(int index)\n\n public abstract Mutation getMutations(int index)\n\nThe mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\n When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\n entity.\n\n`repeated .google.datastore.v1.Mutation mutations = 6;`\n\n### getMutationsCount()\n\n public abstract int getMutationsCount()\n\nThe mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\n When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\n entity.\n\n`repeated .google.datastore.v1.Mutation mutations = 6;`\n\n### getMutationsList()\n\n public abstract List\u003cMutation\u003e getMutationsList()\n\nThe mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\n When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\n entity.\n\n`repeated .google.datastore.v1.Mutation mutations = 6;`\n\n### getMutationsOrBuilder(int index)\n\n public abstract MutationOrBuilder getMutationsOrBuilder(int index)\n\nThe mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\n When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\n entity.\n\n`repeated .google.datastore.v1.Mutation mutations = 6;`\n\n### getMutationsOrBuilderList()\n\n public abstract List\u003c? extends MutationOrBuilder\u003e getMutationsOrBuilderList()\n\nThe mutations to perform.\n\nWhen mode is `TRANSACTIONAL`, mutations affecting a single entity are\napplied in order. The following sequences of mutations affecting a single\nentity are not permitted in a single `Commit` request:\n\n- `insert` followed by `insert`\n- `update` followed by `insert`\n- `upsert` followed by `insert`\n- `delete` followed by `update`\n\n When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single\n entity.\n\n`repeated .google.datastore.v1.Mutation mutations = 6;`\n\n### getProjectId()\n\n public abstract String getProjectId()\n\nRequired. The ID of the project against which to make the request.\n\n`string project_id = 8 [(.google.api.field_behavior) = REQUIRED];`\n\n### getProjectIdBytes()\n\n public abstract ByteString getProjectIdBytes()\n\nRequired. The ID of the project against which to make the request.\n\n`string project_id = 8 [(.google.api.field_behavior) = REQUIRED];`\n\n### getSingleUseTransaction()\n\n public abstract TransactionOptions getSingleUseTransaction()\n\nOptions for beginning a new transaction for this request.\nThe transaction is committed when the request completes. If specified,\nTransactionOptions.mode must be\nTransactionOptions.ReadWrite.\n\n`.google.datastore.v1.TransactionOptions single_use_transaction = 10;`\n\n### getSingleUseTransactionOrBuilder()\n\n public abstract TransactionOptionsOrBuilder getSingleUseTransactionOrBuilder()\n\nOptions for beginning a new transaction for this request.\nThe transaction is committed when the request completes. If specified,\nTransactionOptions.mode must be\nTransactionOptions.ReadWrite.\n\n`.google.datastore.v1.TransactionOptions single_use_transaction = 10;`\n\n### getTransaction()\n\n public abstract ByteString getTransaction()\n\nThe identifier of the transaction associated with the commit. A\ntransaction identifier is returned by a call to\nDatastore.BeginTransaction.\n\n`bytes transaction = 1;`\n\n### getTransactionSelectorCase()\n\n public abstract CommitRequest.TransactionSelectorCase getTransactionSelectorCase()\n\n### hasSingleUseTransaction()\n\n public abstract boolean hasSingleUseTransaction()\n\nOptions for beginning a new transaction for this request.\nThe transaction is committed when the request completes. If specified,\nTransactionOptions.mode must be\nTransactionOptions.ReadWrite.\n\n`.google.datastore.v1.TransactionOptions single_use_transaction = 10;`\n\n### hasTransaction()\n\n public abstract boolean hasTransaction()\n\nThe identifier of the transaction associated with the commit. A\ntransaction identifier is returned by a call to\nDatastore.BeginTransaction.\n\n`bytes transaction = 1;`"]]