# Convenience Methods and Explicit Storing (Transactions)

{% hint style="warning" %}
**This is the manual for older MicroStream versions (Version < 5.0).**

**The new documentation (Version >= 5.0) is located at:**

[https://docs.microstream.one/](https://docs.microstream.one/manual)
{% endhint %}

## Convenience Methods

Beside `long store(Object instance)`  MicroStream provides some convenience methods to store several objects at once:

`void storeAll(Iterable<?> instances)`

Stores the passed instance in any case and all referenced instances of persistable references recursively, but stores referenced instances only if they are newly encountered (e.g. don't have an id associated with them in the object registry, yet and are therefore required to be handled). This is useful for the common case of just storing an updated instance and potentially newly created instances along with it while skipping all existing (and normally unchanged) referenced instances.

```java
List subset = myCollection.getSubset();
subset.foreach( item -> item.modify());
storage.storeAll(subset);
```

`long[] storeAll(Object... instances)`

Convenience method to store multiple instances. The passed array (maybe implicitly created by the compiler) itself is NOT stored.

```java
storage.storeAll(itemA, iteamB, iteamC);
```

## Transactions

MicroStream does not provide explicit transactions, every call to a store method is automatically a transaction. **A store operation is an atomic all or nothing operation**. if the store call is successful all data is written to the storage. Otherwise no data is persisted. Partially persisted data will be reverted.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.docs.microstream.one/2.2/data-store/storing-data/convenience-methods-and-explicit-storing-transactions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
