# Best Practice

{% 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 %}

## Storing Hidden Encapsulated Objects

In some cases, it can be necessary to store modified encapsulated objects that cannot be a accessed from your code.&#x20;

```java
public class ForeignObject
{
    ...
    private HiddenObject hidden;
    ...
}
```

In the upper code snippet the "hidden" object cannot be accessed by `store(myForeignObject.hidden)` if no getter is available. To allow such hidden objects to be stored after they have been modified you have to options:

1. Set the global storing strategy of the MicroStream instance to [eager storing](https://manual.docs.microstream.one/3.0/data-store/storing-data/lazy-eager-full)\
   or
2. Implement and set a custom [`PersistenceEagerStoringFieldEvaluator`](https://manual.docs.microstream.one/3.0/data-store/customizing/custom-storing-behavior) for this field.

```java
EmbeddedStorageManager storage = EmbeddedStorage.Foundation()
	.onConnectionFoundation(
		f -> f.setReferenceFieldEagerEvaluator(
			new CustomEagerStoringFieldEvaluator()
		)
	)
	.start();
```

## Use Immutable data models

To increase performance use immutable sub-graphs as often as possible. Storing those with the provided [convenience storing methods](https://manual.docs.microstream.one/3.0/data-store/storing-data/convenience-methods-and-explicit-storing-transactions) or using a thread local [storer ](https://manual.docs.microstream.one/3.0/data-store/lazy-eager-full#usage)to insert those sub-graphs concurrently can give a great performance boost.
