Loading Data
This is the manual for older MicroStream versions (Version < 5.0).
The new documentation (Version >= 5.0) is located at:
Loading data can be done in two ways, eager and Lazy. The basic, default way of loading is eager loading. This means that all objects of a stored object graph are loaded immediately. This is done during startup of the MicroStream database instance automatically if an already existing database is found.
Contrary to lazy loading, eager loading has no requirements to your entity model.
To load your data you just need to create an EmbeddedStorageManager instance:
EmbeddedStorageManager storage = EmbeddedStorage.start();
After that just get the root instance of your object graph from the StorageManager by calling EmbeddedStorageManager.root() and check for null as this indicates a non-existing database
final EmbeddedStorageManager storage = EmbeddedStorage.start();
if(storage.root() == null)
//No existing Database found
MyRoot root = (MyRoot) storage.root();
The full code for the eager loading example is on GitHub.
Export as PDF
Copy link