You are here: Object Manager Enterprise > Custom Configuration

Custom Configuration

When the database cannot be opened with OMJ you should try to pass your configuration to OMJ. This ensures that OMJ opens the database the same way as your application does.

Prepare Configuration Jar File

First you need to prepare a jar-file which contains code to configure OMJ. You do this by implementing the EmbeddedConfigurationItem-interface or implementing ClientConfigurationItem-interface.

In the implementation you can apply all the configuration settings to the object container which you use in your application.

public class ConfigureDBForOmj implements EmbeddedConfigurationItem{
    public void prepare(EmbeddedConfiguration embeddedConfiguration) {
        // Your configuration goes here.
        // For example:
        embeddedConfiguration.common().add(new UuidSupport());
    }

    public void apply(EmbeddedObjectContainer embeddedObjectContainer) {
    }
}
ConfigureDBForOmj.java: A configuration item for Java

Then create the file 'com.db4o.config.EmbeddedConfigurationItem' in the 'META-INF/services' folder of your jar. Add the fully qualified name of your EmbeddedConfigurationItem/ClientConfigurationItem-implementation. You can list as many implementations as you want.

com.db4odoc.omj.ConfigureDBForOmj
com.db4o.config.EmbeddedConfigurationItem: List all configuration items for OMJ

Finally you need to package the compiled code and the 'META-INF/service' folder into a jar-file. The jar-layout should be like this:

Using the Configuration in OMJ

After that you can choose the 'Custom config...' option on the open-dialog. There add the jar-file you've build previously. On the right all configuration-items are listed. Select the appropriate configuration items for your database.