3.2.2. Runtime Configuration
The OpenJPA runtime includes a comprehensive system of configuration defaults and overrides:
-
OpenJPA first looks for an optional openjpa.xml resource. OpenJPA searches for this resource in each top-level directory of your
CLASSPATH. OpenJPA will also find the resource if you place it within a META-INF directory in any top-level directory of theCLASSPATH. The openjpa.xml resource contains property settings in JPA’s XML format. -
You can customize the name or location of the above resource by specifying the correct resource path in the
openjpa.propertiesSystem 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
Persistenceclass at runtime override the values in the above resource, as well as any System property settings. TheMappassed toPersistence.createEntityManagerFactoryat runtime also overrides previous settings, including properties defined in persistence.xml. -
In JPA, The
Mappassed to the methods defined in theQueryandEntityManagerinterfaces at runtime also overrides previous settings, including properties defined in persistence.xml. TheMapis in effect only during the method invocation. -
When using JCA deployment the
config-propertyvalues in your ra.xml file override other settings. -
All OpenJPA command-line tools accept flags that allow you to specify the configuration resource to use, and to override any property. Command Line Configuration describes these flags.
|
|
Internally, the OpenJPA runtime environment and development tools manipulate property settings through a general Configuration interface, and in particular its OpenJPAConfiguration and JDBCConfiguration subclasses. For advanced customization, OpenJPA’s extended runtime interfaces and its development tools allow you to access these interfaces directly. See the Javadoc for details. |