blob: 7738a829494cd999c69bf34fedb23bfc84e60cc2 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>9.&nbsp;Key Join Columns</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_mapping.html" title="Chapter&nbsp;7.&nbsp; Mapping"><link rel="prev" href="ref_guide_mapping_jpa_map_keycols.html" title="8.&nbsp;Key Columns"><link rel="next" href="ref_guide_mapping_jpa_map_embedkey.html" title="10.&nbsp;Key Embedded Mapping"></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">9.&nbsp;Key Join Columns</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ref_guide_mapping_jpa_map_keycols.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;7.&nbsp;
Mapping
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ref_guide_mapping_jpa_map_embedkey.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ref_guide_mapping_jpa_map_keyjoincols"></a>9.&nbsp;Key Join Columns</h2></div></div></div><a class="indexterm" name="d0e27505"></a><p>
Key join columns are equivalent to standard JPA
join columns, except that they represent a join to a map key entity rather than a direct relation. You represent
a key join column with OpenJPA's
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/persistence/jdbc/KeyJoinColumn.html" target="_top">
<code class="classname">org.apache.openjpa.persistence.jdbc.KeyJoinColumn</code></a> annotation. To declare a compound join, enclose an
array of <code class="classname">KeyJoinColumn</code>s in the
<a xmlns:xlink="http://www.w3.org/1999/xlink" href="../javadoc/org/apache/openjpa/persistence/jdbc/KeyJoinColumns.html" target="_top">
<code class="classname">org.apache.openjpa.persistence.jdbc.KeyJoinColumns</code>
</a> annotation.
</p><p>
A <code class="classname">KeyJoinColumn</code> always resides in
a container table, so it does not have the <code class="literal">table</code> property
of a standard <code class="classname">JoinColumn</code>. Like <code class="classname">XJoinColumn</code>s above,
<code class="classname">KeyJoinColumn</code>s can reference a linked field
rather than a static linked column. Otherwise, the <code class="classname">KeyJoinColumn</code>
and standard <code class="classname">JoinColumn</code> annotations are equivalent. See
<a href="jpa_overview_mapping_field.html#jpa_overview_mapping_rel" title="8.4.&nbsp; Direct Relations">Section&nbsp;8.4, &#8220;
Direct Relations
&#8221;</a> in the JPA
Overview for a review of the <code class="classname">JoinColumn</code> annotation.
</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ref_guide_mapping_jpa_map_keycols.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ref_guide_mapping.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ref_guide_mapping_jpa_map_embedkey.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">8.&nbsp;Key Columns&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;10.&nbsp;Key Embedded Mapping</td></tr></table></div></body></html>