blob: 9ac3933246f0cd5382e5e3b74ef145184dca6590 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Chapter&nbsp;5.&nbsp; Persistent Classes</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.4 User's Guide"><link rel="up" href="ref_guide.html" title="Part&nbsp;3.&nbsp;Reference Guide"><link rel="prev" href="ref_guide_schema_xml.html" title="14.&nbsp; XML Schema Format"><link rel="next" href="ref_guide_pc_enhance.html" title="2.&nbsp; 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&nbsp;5.&nbsp;
Persistent Classes
</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_schema_xml.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_pc_enhance.html">Next</a></td></tr></table><hr></div><div class="chapter" id="ref_guide_pc"><div class="titlepage"><div><div><h2 class="title">Chapter&nbsp;5.&nbsp;
Persistent Classes
</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><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="d5e12108"></a>
<p>
Persistent class basics are covered in <a class="xref" href="jpa_overview_pc.html" title="Chapter&nbsp;4.&nbsp; Entity">Chapter&nbsp;4, <i>
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" id="ref_guide_pc_pcclasses"><div class="titlepage"><div><div><h2 class="title" style="clear: both">1.&nbsp;
Persistent Class List
</h2></div></div></div>
<a class="indexterm" name="d5e12114"></a>
<a class="indexterm" name="d5e12117"></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 class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<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 class="listitem">
<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 class="listitem">
<p>
If you configure OpenJPA to create the needed database schema on startup (see
<a class="xref" href="ref_guide_mapping.html#ref_guide_mapping_synch" title="1.3.&nbsp; Runtime Forward Mapping">Section&nbsp;1.3, &#8220;
Runtime Forward Mapping
&#8221;</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 class="xref" href="jpa_overview_persistence.html#jpa_overview_persistence_xml" title="1.&nbsp; persistence.xml">Section&nbsp;1, &#8220;
persistence.xml
&#8221;</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 class="xref" href="ref_guide_meta.html#ref_guide_meta_factory" title="1.&nbsp; Metadata Factory">Section&nbsp;1, &#8220;
Metadata Factory
&#8221;</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>&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_pc_enhance.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">14.&nbsp;
XML Schema Format
&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;
Enhancement
</td></tr></table></div></body></html>