# Class BulkMutation (2.79.0)

2.79.0 (latest) 2.78.1 2.77.0 2.74.0 2.73.0 2.72.0 2.71.0 2.70.0 2.68.0 2.67.1 2.66.0 2.65.1 2.63.0 2.62.0 2.61.0 2.60.0 2.59.0 2.58.2 2.56.0 2.54.0 2.52.0 2.51.2 2.49.0 2.46.0 2.45.1 2.44.1 2.43.0 2.42.0 2.40.0 2.39.5 2.37.0 2.35.1 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.1 2.28.0

    public final class BulkMutation implements Serializable, Cloneable

Represents a list of mutations for multiple rows. Each mutation contains multiple changes that
will be atomically applied to each row. However, ordering between rows is not guaranteed.

This class is meant for manual batching.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> BulkMutation

## Implements

[Serializable](https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html), [Cloneable](https://docs.oracle.com/javase/8/docs/api/java/lang/Cloneable.html)

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Static Methods

### create(TargetId targetId)

    public static BulkMutation create(TargetId targetId)

Creates a new instance of the bulk mutation builder for the given target with targetId.
See Also: [TableId](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.TableId), [AuthorizedViewId](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.AuthorizedViewId)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `targetId` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.TargetId` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

### create(String tableId) (deprecated)

    public static BulkMutation create(String tableId)

**Deprecated.** *Please use [BulkMutation#create(TargetId)](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation#com_google_cloud_bigtable_data_v2_models_BulkMutation_create_com_google_cloud_bigtable_data_v2_models_TargetId_) instead.*

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `tableId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

### fromProto(MutateRowsRequest request)

    public static BulkMutation fromProto(MutateRowsRequest request)

> [!WARNING]
> **Beta**
>
> This feature is covered by the [Pre-GA Offerings Terms](https://docs.cloud.google.com/terms/service-terms#1) of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see the launch stage descriptions.

Wraps the protobuf MutateRowsRequest.

This is meant for advanced usage only. Please ensure that the MutateRowsRequest does not use
server side timestamps. The BigtableDataClient assumes that mutation present in BulkMutation
are idempotent and is configured to enable retries by default. If serverside timestamps are
enabled then that can lead to duplicate mutations.

WARNING: when applied, the resulting mutation object will ignore the project id and instance
id in the table_name and instead apply the configuration in the client.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.bigtable.v2.MutateRowsRequest` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

## Methods

### add(RowMutationEntry entry)

    public BulkMutation add(RowMutationEntry entry)

Add mutation for a particular row. The changes in the mutation will be applied atomic. However
there is no guarantees about the relative ordering between mutations affecting different rows.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `entry` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.RowMutationEntry` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

### add(ByteString rowKey, Mutation mutation)

    public BulkMutation add(ByteString rowKey, Mutation mutation)

Add mutation for a particular row. The changes in the mutation will be applied atomic. However
there is no guarantees about the relative ordering between mutations affecting different rows.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `rowKey` | `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` |
| `mutation` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Mutation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

### add(String rowKey, Mutation mutation)

    public BulkMutation add(String rowKey, Mutation mutation)

Add mutation for a particular row. The changes in the mutation will be applied atomically.
However there is no guarantees about the relative ordering between mutations affecting
different rows.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `rowKey` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `mutation` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.Mutation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

### clone()

    public BulkMutation clone()

Creates a copy of [BulkMutation](https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-bigtable/latest/com.google.cloud.bigtable.data.v2.models.BulkMutation` |   |

**Overrides** [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--)

### getEntryCount()

    public int getEntryCount()

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

### toProto(RequestContext requestContext)

    public MutateRowsRequest toProto(RequestContext requestContext)

> [!WARNING]
> **Internal Only**: This feature is not stable for application use.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `requestContext` | `com.google.cloud.bigtable.data.v2.internal.RequestContext` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.bigtable.v2.MutateRowsRequest` |   |