blob: ecf78c632f4d72e2232e8e5d7ceea2ab6d0d4a55 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>2.&nbsp; Runtime Configuration</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.2 User's Guide"><link rel="up" href="ref_guide_conf.html" title="Chapter&nbsp;2.&nbsp; Configuration"><link rel="prev" href="ref_guide_conf.html" title="Chapter&nbsp;2.&nbsp; Configuration"><link rel="next" href="ref_guide_conf_devtools.html" title="3.&nbsp; Command Line Configuration"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2.&nbsp;
Runtime Configuration
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_conf.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;2.&nbsp;
Configuration
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_conf_devtools.html">Next</a></td></tr></table><hr></div><div class="section" title="2.&nbsp; Runtime Configuration"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="ref_guide_conf_specify">2.&nbsp;
Runtime Configuration
</h2></div></div></div>
<a class="indexterm" name="d5e6711"></a>
<p>
The OpenJPA runtime includes a comprehensive system of configuration defaults
and overrides:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>
<a class="indexterm" name="d5e6718"></a>
OpenJPA first looks for an optional <code class="filename">openjpa.xml</code> resource.
OpenJPA searches for this resource in each top-level directory of your <code class="literal">
CLASSPATH</code>. OpenJPA will also find the resource if you place it within
a <code class="filename">META-INF</code> directory in any top-level directory of the
<code class="literal">CLASSPATH</code>. The <code class="filename">openjpa.xml</code> resource
contains property settings in <a class="link" href="jpa_overview_persistence.html#jpa_overview_persistence_xml" title="1.&nbsp; persistence.xml">
JPA's XML format</a>.
</p>
</li><li class="listitem">
<p>
You can customize the name or location of the above resource by specifying the
correct resource path in the <code class="literal">openjpa.properties</code> System
property.
</p>
</li><li class="listitem">
<p>
You can override any value defined in the above resource by setting the System
property of the same name to the desired value.
</p>
</li><li class="listitem">
<p>
<a class="indexterm" name="d5e6733"></a>
In JPA, the values in the standard <code class="filename"> META-INF/persistence.xml
</code> bootstrapping file used by the
<a class="link" href="jpa_overview_persistence.html" title="Chapter&nbsp;6.&nbsp; Persistence"><code class="classname">Persistence</code>
</a> class at runtime override the values in the above resource, as well as
any System property settings. The <code class="classname">Map</code> passed to
<code class="methodname">Persistence.createEntityManagerFactory</code> at runtime also
overrides previous settings, including properties defined in <code class="filename">
persistence.xml</code>.
</p>
</li><li class="listitem">
<p>
In JPA, The <code class="classname">Map</code> passed to the methods defined in the
<code class="classname">Query</code> and <code class="classname">EntityManager</code> interfaces
at runtime also overrides previous settings, including properties defined in
<code class="filename">persistence.xml</code>. The <code class="classname">Map</code> is in
effect only during the method invocation.
</p>
</li><li class="listitem">
<p>
When using JCA deployment the <code class="literal">config-property</code> values in your
<code class="filename">ra.xml</code> file override other settings.
</p>
</li><li class="listitem">
<p>
All OpenJPA command-line tools accept flags that allow you to specify the
configuration resource to use, and to override any property.
<a class="xref" href="ref_guide_conf_devtools.html" title="3.&nbsp; Command Line Configuration">Section&nbsp;3, &#8220;
Command Line Configuration
&#8221;</a> describes these flags.
</p>
</li></ul></div>
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p>
Internally, the OpenJPA runtime environment and development
tools manipulate property settings through a general
<a class="ulink" href="../javadoc/org/apache/openjpa/lib/conf/Configuration.html" target="_top">
<code class="classname">Configuration</code></a> interface, and in particular its
<a class="ulink" href="../javadoc/org/apache/openjpa/conf/OpenJPAConfiguration.html" target="_top">
<code class="classname">OpenJPAConfiguration</code></a> and
<a class="ulink" href="../javadoc/org/apache/openjpa/jdbc/conf/JDBCConfiguration.html" target="_top">
<code class="classname">JDBCConfiguration</code></a> subclasses. For advanced
customization, OpenJPA's extended runtime interfaces and its development tools
allow you to access these interfaces directly. See the <a class="ulink" href="../javadoc/" target="_top">
Javadoc</a> for details.
</p>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_conf.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide_conf.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_conf_devtools.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;2.&nbsp;
Configuration
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;3.&nbsp;
Command Line Configuration
</td></tr></table></div></body></html>