You are here: Configuration > Common Configuration > Update Depth

Update Depth

By default db4o only stores changes on the updated object but not the changes on referenced objects. With a higher update-depth db4o will traverse along the object graph to a certain depth and update all objects. See "Update Concept"

Note: As soon as you use transparent persistence this configuration option has no effect and isn't needed.

With the update-depth you configure how deep db4o updates the object-graph.

EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration();
configuration.common().updateDepth(2);
CommonConfigurationExamples.java: Increasing the update-depth

A higher update depth is usually more convenient, because you don't need to explicitly store each changed object. However the higher the update depth is the more time it takes to update the objects. Therefore it is a tradeoff. Note that you can also use transparent persistence, which takes of updating the right objects.

Class Specific Configuration

You can also configure a class specific update depth. See "Class Specific Configuration"

EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration();
configuration.common().objectClass(Person.class).updateDepth(2);
ObjectConfigurationExamples.java: Set the update depth