7.2. Automatic Runtime Mapping
Prev | Chapter 7. Object-Relational Mapping | Next

## 7.2. Automatic Runtime Mapping

You can configure Kodo to automatically create O/R mapping information and the database schema at runtime through the `kodo.jdbc.SynchronizeMappings` configuration property. Using this property saves you the trouble of running the mapping tool manually, and is meant for use during rapid test/debug cycles.

In order to enable automatic runtime mapping, you must first set the `kodo.PersistentClasses` property to include all the persistent classes. Kodo will run the mapping tool on these classes when your application obtains its first persistence manager.

The `kodo.jdbc.SynchronizeSchema` configuration property accepts the following values:

- `false`: The default. No runtime mapping synchronization is performed.

- `refresh`: Invoke the mapping tool with the refresh action, which throws out all existing O/R mapping data that doesn't match the current schema, creates new O/R mappings for unmapped classes and fields, and modifies the schema to match the new mappings.

- `buildSchema`: Invoke the mapping tool with the buildSchema action. This action requires that all your classes and fields already have mapping information, and synchronizes the database schema to match that information.

Prev | Up | Next
Chapter 7. Object-Relational Mapping | Home | 7.3. Mapping Factory