2.3. Runtime Configuration
Prev | Chapter 2. Configuration | Next

## 2.3. Runtime Configuration

The Kodo runtime includes a comprehensive system of configuration defaults and overrides:

- Kodo first looks for an optional `kodo.xml` resource. Kodo searches for this resource in each top-level directory of your `CLASSPATH`. Kodo will also find the resource if you place it within a `META-INF` directory in any top-level directory of the `CLASSPATH`. The `kodo.xml` resource contains property settings in JPA's XML format.

  If Kodo discovers a `kodo.xml` resource, specification-dependent settings default to JPA values.

- If Kodo does not find a `kodo.xml` resource, it turns to JDO. Kodo JDO searches for an optional `kodo.properties` resource. Place this resource in any top-level directory of the `CLASSPATH`, or within a `META-INF` directory in any top-level directory of the `CLASSPATH`. If found, this resource is parsed as a standard Java properties file.

  If Kodo discovers a `kodo.properties` resource, specification-dependent settings default to JDO values.

- You can customize the name or location of the above resource by specifying the correct resource path in the `kodo.properties` System property.

- You can override any value defined in the above resource by setting the System property of the same name to the desired value.

- In JPA, the values in the standard `META-INF/persistence.xml` bootstrapping file used by the `Persistence` class at runtime override the values in the above resource, as well as any System property settings. The `Map` passed to `Persistence.createEntityManagerFactory` at runtime also overrides previous settings, including properties defined in `persistence.xml`.

- In JDO, the values in the `Properties` object passed to `JDOHelper.getPersistenceManagerFactory` at runtime override the values in the above resource, as well as any System property settings.

- When using JCA deployment the `config-property` values in your `ra.xml` file override other settings.

- All Kodo command-line tools accept flags that allow you to specify the configuration resource to use, and to override any property. Section 2.4, “Command Line Configuration” describes these flags.

| Note
Internally, the Kodo JPA/JDO runtime environment and development tools manipulate property settings through a general `Configuration` interface, and in particular its `KodoConfiguration` and `JDBCConfiguration` subclasses. For advanced customization, Kodo's extended runtime interfaces and its development tools allow you to access these interfaces directly. See the Javadoc for details.

Prev | Up | Next
2.2. License Configuration | Home | 2.4. Command Line Configuration