|  | <html><head> | 
|  | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | 
|  | <title>Chapter 5.  Persistent Classes</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><base href="display"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA 2.0 User's Guide"><link rel="up" href="ref_guide.html" title="Part 3. Reference Guide"><link rel="prev" href="ref_guide_schema_xml.html" title="14.  XML Schema Format"><link rel="next" href="ref_guide_pc_enhance.html" title="2.  Enhancement"></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 5.  | 
|  | Persistent Classes | 
|  | </th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_schema_xml.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_pc_enhance.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en" id="ref_guide_pc"><div class="titlepage"><div><div><h2 class="title"><a name="ref_guide_pc"></a>Chapter 5.  | 
|  | Persistent Classes | 
|  | </h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="ref_guide_pc.html#ref_guide_pc_pcclasses">1. | 
|  | Persistent Class List | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_enhance.html">2. | 
|  | Enhancement | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_pc_enhance.html#ref_guide_pc_enhance_build">2.1. | 
|  | Enhancing at Build Time | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_enhance.html#ref_guide_pc_enhance_runtime_container">2.2. | 
|  | Enhancing JPA Entities on Deployment | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_enhance.html#ref_guide_pc_enhance_runtime">2.3. | 
|  | Enhancing at Runtime | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_enhance.html#ref_guide_pc_enhance_dynamic">2.4. | 
|  | Enhancing Dynamically at Runtime | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_enhance.html#ref_guide_pc_enhance_unenhanced_types">2.5. | 
|  | Omitting the OpenJPA enhancer | 
|  | </a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_pc_interfaces.html">3. Managed Interfaces</a></span></dt><dt><span class="section"><a href="ref_guide_pc_oid.html">4. | 
|  | Object Identity | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_pc_oid.html#ref_guide_pc_oid_datastore">4.1. | 
|  | Datastore Identity | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_oid.html#ref_guide_pc_oid_entitypk">4.2. | 
|  | Entities as Identity Fields | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_oid.html#ref_guide_pc_oid_application">4.3. | 
|  | Application Identity Tool | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_oid.html#ref_guide_pc_oid_pkgen_autoinc">4.4. | 
|  | Autoassign / Identity Strategy Caveats | 
|  | </a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_inverses.html">5. | 
|  | Managed Inverses | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html">6. | 
|  | Persistent Fields | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_restore">6.1. | 
|  | Restoring State | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_order">6.2. | 
|  | Typing and Ordering | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_calendar_timezone">6.3. | 
|  | Calendar Fields and TimeZones | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_proxy">6.4. | 
|  | Proxies | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_proxy_smart">6.4.1. | 
|  | Smart Proxies | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_proxy_lrs">6.4.2. | 
|  | Large Result Set Proxies | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_proxy_custom">6.4.3. | 
|  | Custom Proxies | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_scos_proxy_serial">6.4.4. | 
|  | Serialization | 
|  | </a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_extern">6.5. | 
|  | Externalization | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_pc_scos.html#ref_guide_pc_extern_values">6.5.1. | 
|  | External Values | 
|  | </a></span></dt></dl></dd></dl></dd><dt><span class="section"><a href="ref_guide_fetch.html">7. | 
|  | Fetch Groups | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_fetch.html#ref_guide_fetch_custom">7.1. | 
|  | Custom Fetch Groups | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_fetch.html#ref_guide_fetch_conf">7.2. | 
|  | Custom Fetch Group Configuration | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_fetch.html#ref_guide_fetch_single_field">7.3. | 
|  | Per-field Fetch Configuration | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_fetch.html#ref_guide_fetch_impl">7.4. | 
|  | Implementation Notes | 
|  | </a></span></dt></dl></dd><dt><span class="section"><a href="ref_guide_perfpack_eager.html">8. | 
|  | Eager Fetching | 
|  | </a></span></dt><dd><dl><dt><span class="section"><a href="ref_guide_perfpack_eager.html#ref_guide_perfpack_eager_conf">8.1. | 
|  | Configuring Eager Fetching | 
|  | </a></span></dt><dt><span class="section"><a href="ref_guide_perfpack_eager.html#ref_guide_perfpack_eager_consider">8.2. | 
|  | Eager Fetching Considerations and Limitations | 
|  | </a></span></dt></dl></dd></dl></div><a class="indexterm" name="d0e24924"></a><p> | 
|  | Persistent class basics are covered in <a href="jpa_overview_pc.html" title="Chapter 4.  Entity">Chapter 4, <i xmlns:xlink="http://www.w3.org/1999/xlink"> | 
|  | Entity | 
|  | </i></a> | 
|  | of the JPA Overview. This chapter details the persistent class features OpenJPA | 
|  | offers beyond the core JPA specification. | 
|  | </p><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_pc_pcclasses"></a>1.  | 
|  | Persistent Class List | 
|  | </h2></div></div></div><a class="indexterm" name="d0e24934"></a><a class="indexterm" name="d0e24939"></a><p> | 
|  | Unlike many ORM products, OpenJPA does not need to know about all of your | 
|  | persistent classes at startup. OpenJPA discovers new persistent classes | 
|  | automatically as they are loaded into the JVM; in fact you can introduce new | 
|  | persistent classes into running applications under OpenJPA. However, there are | 
|  | certain situations in which providing OpenJPA with a persistent class list is | 
|  | helpful: | 
|  | </p><div class="itemizedlist"><ul type="disc"><li><p> | 
|  | OpenJPA must be able to match entity names in JPQL queries to persistent | 
|  | classes. OpenJPA automatically knows the entity names of any persistent classes | 
|  | already loaded into the JVM. To match entity names to classes that have not been | 
|  | loaded, however, you must supply a persistent class list. | 
|  | </p></li><li><p> | 
|  | When OpenJPA manipulates classes in a persistent inheritance hierarchy, OpenJPA | 
|  | must be aware of all the classes in the hierarchy. If some of the classes have | 
|  | not been loaded into the JVM yet, OpenJPA may not know about them, and queries | 
|  | may return incorrect results. | 
|  | </p></li><li><p> | 
|  | If you configure OpenJPA to create the needed database schema on startup (see | 
|  | <a href="ref_guide_mapping.html#ref_guide_mapping_synch" title="1.3.  Runtime Forward Mapping">Section 1.3, “ | 
|  | Runtime Forward Mapping | 
|  | ”</a>), OpenJPA must know all of your | 
|  | persistent classes up-front. | 
|  | </p></li></ul></div><p> | 
|  | When any of these conditions are a factor in your JPA application, use the | 
|  | <code class="literal">class</code>, <code class="literal">mapping-file</code>, and <code class="literal"> | 
|  | jar-file</code> elements of JPA's standard XML format to list your persistent | 
|  | classes. See <a href="jpa_overview_persistence.html#jpa_overview_persistence_xml" title="1.  persistence.xml">Section 1, “ | 
|  | persistence.xml | 
|  | ”</a> for details. | 
|  | </p><p> | 
|  | Alternately, you can tell OpenJPA to search through your classpath for | 
|  | persistent types. This is described in more detail in | 
|  | <a href="ref_guide_meta.html#ref_guide_meta_factory" title="1.  Metadata Factory">Section 1, “ | 
|  | Metadata Factory | 
|  | ”</a>. | 
|  | </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p> | 
|  | Listing persistent classes (or their metadata or jar files) is an all-or-nothing | 
|  | endeavor. If your persistent class list is non-empty, OpenJPA will assume that | 
|  | any unlisted class is not persistent. | 
|  | </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_schema_xml.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_pc_enhance.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">14.  | 
|  | XML Schema Format | 
|  |  </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> 2.  | 
|  | Enhancement | 
|  | </td></tr></table></div></body></html> |