Some settings are field-specific. It's part of the object-configuration, which is available on the client, server and embedded-mode of db4o.
Its recommended that you use the same configuration for the client and the server.
The configuration for a field follows the same pattern. First you specify for which type this configuration applies. You pass the type or the name as string. Then you navigate to the specific field by passing the field name as string.
Index dramatically speed up queries. You should index all fields which you run queries on. See "Indexing"
@Indexed
private String zipCode;
As alternative you can externally configure a field index:
EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration(); configuration.common().objectClass(Person.class).objectField("name").indexed(true);
As an alternative you also can use the appropriate Annotation on the field which you want to index.
db4o uses the concept of activation to avoid loading to much data into memory. When this setting is turned on, the object referenced by this field is activated, when the object is activated.
Note: As soon as you use transparent activation/persistence this configuration option has no effect.EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration(); configuration.common().objectClass(Person.class).objectField("father").cascadeOnActivate(true);
When the object is updated, the object referenced by this field is also updated.
Note: As soon as you use transparent persistence this configuration option has no effect and isn't needed.EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration(); configuration.common().objectClass(Person.class).objectField("father").cascadeOnUpdate(true);
When the object is deleted, the object referenced by this field is also deleted
EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration(); configuration.common().objectClass(Person.class).objectField("father").cascadeOnDelete(true);
Allows you to rename this field. . See "Refactoring and Schema Evolution"
EmbeddedConfiguration configuration = Db4oEmbedded.newConfiguration(); configuration.common().objectClass(Person.class).objectField("name").rename("sirname");