| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>2. 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.4 User's Guide"><link rel="up" href="ref_guide_conf.html" title="Chapter 2. Configuration"><link rel="prev" href="ref_guide_conf.html" title="Chapter 2. Configuration"><link rel="next" href="ref_guide_conf_devtools.html" title="3. 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. |
| Runtime Configuration |
| </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_conf.html">Prev</a> </td><th width="60%" align="center">Chapter 2. |
| Configuration |
| </th><td width="20%" align="right"> <a accesskey="n" href="ref_guide_conf_devtools.html">Next</a></td></tr></table><hr></div><div class="section" title="2. Runtime Configuration"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="ref_guide_conf_specify">2. |
| 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. 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 6. 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. Command Line Configuration">Section 3, “ |
| Command Line Configuration |
| ”</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> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide_conf.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ref_guide_conf_devtools.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 2. |
| Configuration |
| </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 3. |
| Command Line Configuration |
| </td></tr></table></div></body></html> |