|  | <html><head> | 
|  | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | 
|  | <title>Chapter 6.  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 1.2 User's Guide"><link rel="up" href="ref_guide.html" title="Part 3. Reference Guide"><link rel="prev" href="ref_guide_perfpack_eager.html" title="8.  Eager Fetching"><link rel="next" href="ref_guide_meta_repository.html" title="2. Metadata Repository"></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 6.  | 
|  | Metadata | 
|  | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_perfpack_eager.html">Prev</a> </td><th width="60%" align="center">Part 3. Reference Guide</th><td width="20%" align="right"> <a accesskey="n" href="ref_guide_meta_repository.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 6.  | 
|  | 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_repository.html">2. Metadata Repository</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html">3. | 
|  | Additional JPA Metadata | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_datastoreid">3.1. | 
|  | Datastore Identity | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_version">3.2. | 
|  | Surrogate Version | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_persistent">3.3. | 
|  | Persistent Field Values | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_persistent_coll">3.4. Persistent Collection Fields</a></span></dt><dt><span class="section"><a href="ref_guide_meta_jpa.html#ref_guide_meta_jpa_persistent_map">3.5. Persistent Map Fields</a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_meta_ext.html">4. | 
|  | Metadata Extensions | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_ext.html#ref_guide_meta_class">4.1. | 
|  | Class Extensions | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_ext.html#fetch-groups">4.1.1. | 
|  | Fetch Groups | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#data-cache">4.1.2. | 
|  | Data Cache | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#detached-state-field">4.1.3. | 
|  | Detached State | 
|  | </a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_meta_ext.html#ref_guide_meta_field">4.2. | 
|  | Field Extensions | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_meta_ext.html#dependent">4.2.1. | 
|  | Dependent | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#load-fetch-group">4.2.2. | 
|  | Load Fetch Group | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#lrs">4.2.3. | 
|  | LRS | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#inverse-logical">4.2.4. | 
|  | Inverse-Logical | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#read-only">4.2.5. | 
|  | Read-Only | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#type">4.2.6. | 
|  | Type | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#externalizer">4.2.7. | 
|  | Externalizer | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#factory">4.2.8. | 
|  | Factory | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_meta_ext.html#external-values">4.2.9. | 
|  | External Values | 
|  | </a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_meta_ext.html#ref_guide_meta_example">4.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 5.  Metadata">Chapter 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.  | 
|  | Metadata Factory | 
|  | </h2></div></div></div><a class="indexterm" name="d0e24060"></a><p> | 
|  | The <a href="ref_guide_conf_openjpa.html#openjpa.MetaDataFactory" title="5.42.  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.  Plugin Configuration">Section 4, “ | 
|  | Plugin Configuration | 
|  | ”</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.  Mapping Factory">Section 5, “ | 
|  | Mapping Factory | 
|  | ”</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.  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.  Persistent Class List">Section 1, “ | 
|  | Persistent Class List | 
|  | ”</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 6.1.  | 
|  | Setting a Standard Metadata Factory | 
|  | </b></p><div class="example-contents"><pre class="programlisting"> | 
|  | <property name="openjpa.MetaDataFactory" value="jpa(ClasspathScan=build;lib.jar)"/> | 
|  | </pre></div></div><br class="example-break"><div class="example"><a name="ref_guide_meta_customfactoryex"></a><p class="title"><b>Example 6.2.  | 
|  | Setting a Custom Metadata Factory | 
|  | </b></p><div class="example-contents"><pre class="programlisting"> | 
|  | <property name="openjpa.MetaDataFactory" value="com.xyz.CustomMetaDataFactory"/> | 
|  | </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> </td><td width="20%" align="center"><a accesskey="u" href="ref_guide.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ref_guide_meta_repository.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">8.  | 
|  | Eager Fetching | 
|  |  </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 2. Metadata Repository</td></tr></table></div></body></html> |