blob: 9313eeb368219b7eb549a6f3d75f69888c292500 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter&nbsp;6.&nbsp; Metadata</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA User's Guide"><link rel="up" href="ref_guide.html" title="Part&nbsp;3.&nbsp;Reference Guide"><link rel="prev" href="ref_guide_perfpack_eager.html" title="7.&nbsp; Eager Fetching"><link rel="next" href="ref_guide_meta_jpa.html" title="2.&nbsp; Additional JPA Metadata"></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">Chapter&nbsp;6.&nbsp;
Metadata
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_perfpack_eager.html">Prev</a>&nbsp;</td><th width="60%" align="center">Part&nbsp;3.&nbsp;Reference Guide</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_meta_jpa.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en" id="ref_guide_meta"><div class="titlepage"><div><div><h2 class="title"><a name="ref_guide_meta"></a>Chapter&nbsp;6.&nbsp;
Metadata
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ref_guide_meta.html#ref_guide_meta_factory">1.
Metadata Factory
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html">2.
Additional JPA Metadata
</a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_datastoreid">2.1.
Datastore Identity
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_version">2.2.
Surrogate Version
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_persistent">2.3.
Persistent Field Values
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_persistent_coll">2.4. Persistent Collection Fields</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_persistent_map">2.5. Persistent Map Fields</a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_meta_ext.html">3.
Metadata Extensions
</a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_ext.html#ref_guide_meta_class">3.1.
Class Extensions
</a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_ext.html#fetch-groups">3.1.1.
Fetch Groups
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#data-cache">3.1.2.
Data Cache
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#detached-state-field">3.1.3.
Detached State
</a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_meta_ext.html#ref_guide_meta_field">3.2.
Field Extensions
</a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_ext.html#dependent">3.2.1.
Dependent
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#load-fetch-group">3.2.2.
Load Fetch Group
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#lrs">3.2.3.
LRS
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#inverse-logical">3.2.4.
Inverse-Logical
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#read-only">3.2.5.
Read-Only
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#type">3.2.6.
Type
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#externalizer">3.2.7.
Externalizer
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#factory">3.2.8.
Factory
</a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#external-values">3.2.9.
External Values
</a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_meta_ext.html#ref_guide_meta_example">3.3.
Example
</a></span></dt></dl></dd></dl></div><p>
The JPA Overview covers JPA metadata in <a href="jpa_overview_meta.html" title="Chapter&nbsp;5.&nbsp; Metadata">Chapter&nbsp;5, <i xmlns:xlink="http://www.w3.org/1999/xlink">
Metadata
</i></a>.
This chapter discusses OpenJPA's extensions to standard JPA metadata.
</p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_meta_factory"></a>1.&nbsp;
Metadata Factory
</h2></div></div></div><a class="indexterm" name="d0e22805"></a><p>
The <a href="ref_guide_conf_openjpa.html#openjpa.MetaDataFactory" title="5.42.&nbsp; openjpa.MetaDataFactory"><code class="literal">openjpa.MetaDataFactory
</code></a> configuration property controls metadata loading and storing.
This property takes a plugin string (see
<a href="ref_guide_conf_plugins.html" title="4.&nbsp; Plugin Configuration">Section&nbsp;4, &#8220;
Plugin Configuration
&#8221;</a>) describing a concrete
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/meta/MetaDataFactory.html" target="_top">
<code class="classname">org.apache.openjpa.meta.MetaDataFactory</code></a>
implementation. A metadata factory can load mapping information as well as
persistence metadata, or it can leave mapping information to a separate
<span class="emphasis"><em>mapping factory</em></span> (see
<a href="ref_guide_mapping_factory.html" title="5.&nbsp; Mapping Factory">Section&nbsp;5, &#8220;
Mapping Factory
&#8221;</a>). OpenJPA recognizes the
following built-in metadata factories:
</p><div class="itemizedlist"><ul type="disc"><li><p>
<code class="literal">jpa</code>: Standard JPA metadata. This is an alias for the
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/persistence/PersistenceMetaDataFactory.html" target="_top">
<code class="classname">
org.apache.openjpa.persistence.PersistenceMetaDataFactory</code></a>.
</p></li></ul></div><p>
JPA has built-in settings for listing your persistent classes, which
the <a href="jpa_overview_persistence.html#jpa_overview_persistence_xml" title="1.&nbsp; persistence.xml">JPA Overview</a> describes.
OpenJPA supports these JPA standard settings by translating them into its own
internal metadata factory properties. Each internal property represents a
different mechanism for locating persistent types; you can choose the mechanism
or combination of mechanisms that are most convenient. See
<a href="ref_guide_pc.html#ref_guide_pc_pcclasses" title="1.&nbsp; Persistent Class List">Section&nbsp;1, &#8220;
Persistent Class List
&#8221;</a> for a discussion of when it is
necessary to list your persistent classes.
</p><div class="itemizedlist"><ul type="disc"><li><p>
<code class="literal">Types</code>: A semicolon-separated list of fully-qualified
persistent class names.
</p></li><li><p>
<code class="literal">Resources</code>: A semicolon-separated list of resource paths to
metadata files or jar archives. Each jar archive will be scanned for
annotated JPA entities.
</p></li><li><p>
<code class="literal">URLs</code>: A semicolon-separated list of URLs of metadata files
or jar archives. Each jar archive will be scanned for annotated JPA
entities.
</p></li><li><p>
<code class="literal">ClasspathScan</code>: A semicolon-separated list of directories or
jar archives listed in your classpath. Each directory and jar archive will be
scanned for annotated JPA entities.
</p></li></ul></div><div class="example"><a name="ref_guide_meta_stdfactoryex"></a><p class="title"><b>Example&nbsp;6.1.&nbsp;
Setting a Standard Metadata Factory
</b></p><div class="example-contents"><pre class="programlisting">
&lt;property name="openjpa.MetaDataFactory" value="jpa(ClasspathScan=build;lib.jar)"/&gt;
</pre></div></div><br class="example-break"><div class="example"><a name="ref_guide_meta_customfactoryex"></a><p class="title"><b>Example&nbsp;6.2.&nbsp;
Setting a Custom Metadata Factory
</b></p><div class="example-contents"><pre class="programlisting">
&lt;property name="openjpa.MetaDataFactory" value="com.xyz.CustomMetaDataFactory"/&gt;
</pre></div></div><br class="example-break"></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_perfpack_eager.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_meta_jpa.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">7.&nbsp;
Eager Fetching
&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;2.&nbsp;
Additional JPA Metadata
</td></tr></table></div></body></html>