3.8.1.3. Runtime Forward Mapping
You can configure OpenJPA to automatically run the mapping tool at runtime through the openjpa.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 list all your persistent classes as described in Persistent Class List.
OpenJPA will run the mapping tool on these classes when your application obtains its first EntityManager.
The openjpa.jdbc.SynchronizeMappings property is a plugin string (see Plugin Configuration) where the class name is the mapping tool action to invoke, and the properties are the MappingTool class' JavaBean properties.
These properties correspond go the long versions of the tool’s command line flags.
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
The setting above corresponds to running the following command:
java org.apache.openjpa.jdbc.meta.MappingTool -action buildSchema -foreignKeys true