diff options
author | nhauge | 2007-05-04 19:55:48 +0000 |
---|---|---|
committer | nhauge | 2007-05-04 19:55:48 +0000 |
commit | bc72d754f082fe30ef0d7aeff54f29c64553f02a (patch) | |
tree | d69c3c3f38ea93ee78ce6d4529f80d928ee88030 /jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm | |
parent | d8139fbb848c9509ae592b5477c85f5fd34b8ceb (diff) | |
download | webtools.dali-bc72d754f082fe30ef0d7aeff54f29c64553f02a.tar.gz webtools.dali-bc72d754f082fe30ef0d7aeff54f29c64553f02a.tar.xz webtools.dali-bc72d754f082fe30ef0d7aeff54f29c64553f02a.zip |
178911 - Initial check-in for user.doc plugin for Dali 1.0.
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm new file mode 100644 index 0000000000..dd54deb3e8 --- /dev/null +++ b/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm @@ -0,0 +1,143 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<!-- Run date = May 3, 2007 9:19:09 --> +<meta name="OAC_IGNORE_SKIP_NAV" content="true" /> +<title>Specifying entity inheritance</title> +<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> +<meta http-equiv="Content-Style-Type" content="text/css" /> +<meta http-equiv="Content-Script-Type" content="text/javascript" /> +<meta name="generator" content="Oracle DARB XHTML Converter - Version 4.5.3 Build 02" /> +<meta name="date" content="2005-07-10T12:57:20+08:00" /> +<meta name="robots" content="all" scheme="http://www.robotstxt.org/" /> +<meta name="doctitle" content="Specifying entity inheritance" /> +<meta name="relnum" content="Release 1.0.0" /> +<meta name="partnum" content="" /> +<link rel="copyright" href="dcommon/html/cpyr.htm" title="Copyright" type="text/html" /> +<link rel="stylesheet" href="dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /> +<link rel="start" href="../../index.htm" title="Home" type="text/html" /> +<link rel="contents" href="toc.htm" title="Contents" type="text/html" /> +</head> +<body> +<p><a id="CIHCCCJD" name="CIHCCCJD"></a></p> +<div class="sect1"><!-- infolevel="all" infotype="General" --> +<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> +<tr valign="bottom"> +<td align="left" width="86%"> +<h1>Specifying entity inheritance</h1> +</td> +</tr> +</table> +<p><a id="sthref96" name="sthref96"></a><a id="sthref97" name="sthref97"></a>An entity may inherit properties from other entities. You can specify a specific strategy to use for inheritance.</p> +<p>Use this procedure to specify inheritance (<code>@Inheritance)</code> for an existing entity (<code>@Entity</code>):</p> +<ol type="1" start="1"> +<li> +<p>Select the entity in the <span class="gui-object-title">Package Explorer</span>.</p> +</li> +<li> +<p>In the <span class="gui-object-title">JPA Details</span> view, select the <span class="gui-object-action">Inheritance</span> information.</p> +<div class="figure"><a id="sthref98" name="sthref98"></a> +<p class="titleinfigure">Specifying Inheritance</p> +<img src="img/inheritance_tab.png" alt="Selecting the Inheritance tab on the Persistence Properties view." title="Selecting the Inheritance tab on the Persistence Properties view." /><br /></div> +<!-- class="figure" --></li> +<li> +<p>In the <span class="bold">Strategy</span> list, select one of the following the inheritance strategies:</p> +<ul> +<li type="disc"> +<p>A single table (default)</p> +</li> +<li type="disc"> +<p>Joined table</p> +</li> +<li type="disc"> +<p>One table per class</p> +</li> +</ul> +</li> +<li> +<p>Use the following table to complete the remaining fields on the tab. See <a href="reference004.htm#CACFHGHE">"Inheritance information"</a> for additional details.</p> +<div class="inftblruleinformal"> +<table class="RuleInformal" title="This table describes the options on the Persistence Properties view, Inheritance tab." summary="This table describes the options on the Persistence Properties view, Inheritance tab." dir="ltr" border="1" width="100%" frame="border" rules="all" cellpadding="3" cellspacing="0"> +<thead> +<tr align="left" valign="top"> +<th align="left" valign="bottom" id="r1c1-t2">Property</th> +<th align="left" valign="bottom" id="r1c2-t2">Description</th> +<th align="left" valign="bottom" id="r1c3-t2">Default</th> +</tr> +</thead> +<tbody> +<tr align="left" valign="top"> +<td align="left" id="r2c1-t2" headers="r1c1-t2"><a id="sthref99" name="sthref99"></a><a id="sthref100" name="sthref100"></a>Discriminator Column</td> +<td align="left" headers="r2c1-t2 r1c2-t2">Name of the discriminator column when using a <span class="bold">Single</span> or <span class="bold">Joined</span> inheritance strategy. +<p>This field corresponds to the <code>@DiscriminatorColumn</code> annotation.</p> +</td> +<td align="left" headers="r2c1-t2 r1c3-t2"><br /></td> +</tr> +<tr align="left" valign="top"> +<td align="left" id="r3c1-t2" headers="r1c1-t2">Discriminator Type</td> +<td align="left" headers="r3c1-t2 r1c2-t2">Set the discriminator type to <code>Char</code> or <code>Integer</code> (instead of its default: <code>String</code>). The <span class="bold">Discriminator Value</span> must conform to this type.</td> +<td align="left" headers="r3c1-t2 r1c3-t2">String</td> +</tr> +<tr align="left" valign="top"> +<td align="left" id="r4c1-t2" headers="r1c1-t2"><a id="sthref101" name="sthref101"></a><a id="sthref102" name="sthref102"></a>Discriminator Value</td> +<td align="left" headers="r4c1-t2 r1c2-t2">Specify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified <span class="bold">Discriminator Type</span>. +<p>This field corresponds to the <code>@DiscriminatorValue</code> annotation.</p> +</td> +<td align="left" headers="r4c1-t2 r1c3-t2"><br /></td> +</tr> +<tr align="left" valign="top"> +<td align="left" id="r5c1-t2" headers="r1c1-t2">Override Default</td> +<td align="left" headers="r5c1-t2 r1c2-t2">Use this field to specify custom primary key join columns. +<p>This field corresponds to the <code>@PrimaryKeyJoinClumn</code> annotation.</p> +</td> +<td align="left" headers="r5c1-t2 r1c3-t2"><br /></td> +</tr> +</tbody> +</table> +<br /></div> +<!-- class="inftblruleinformal" --></li> +</ol> +<p>Eclipse adds the following annotations the entity field:</p> +<pre xml:space="preserve" class="oac_no_warn"> +@Inheritance(strategy=InheritanceType.<span class="italic"><INHERITANCE_STRATEGY></span>) +@DiscriminatorColumn(name="<span class="italic"><DISCRIMINATOR_COLUMN></span>", + discriminatorType=<span class="italic"><DISCRIMINATOR_TYPE></span>) +@DiscriminatorValue(value-"<span class="italic"><DISCRIMINATOR_VALUE></span>") +@PrimaryKeyJoinColumn(name="<span class="italic"><JOIN_COLUMN_NAME></span>", + referencedColumnName = "<span class="italic"><REFERENCED_COLUMN_NAME></span>") + + +</pre> +<p><a id="sthref103" name="sthref103"></a><a id="sthref104" name="sthref104"></a><a id="sthref105" name="sthref105"></a>The following figures illustrates the different inheritance strategies.</p> +<div class="figure"><a id="sthref106" name="sthref106"></a> +<p class="titleinfigure">Single Table Inheritance</p> +<img src="img/inheritance_single.png" alt="This figure illustrates entity inheritance in a single table." title="This figure illustrates entity inheritance in a single table." /><br /></div> +<!-- class="figure" --> +<div class="figure"><a id="sthref107" name="sthref107"></a> +<p class="titleinfigure"><a id="sthref108" name="sthref108"></a><a id="sthref109" name="sthref109"></a>Joined Table Inheritance</p> +<img src="img/inheritance_join.png" alt="This figure shows a sample joined inheritance table strategy." title="This figure shows a sample joined inheritance table strategy." /><br /></div> +<!-- class="figure" --> +<p> </p> +<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br /> +<br /> +<p> </p> +<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br /> +<br /> +<a href="task_add_persistence.htm#BABHICAI">Adding persistence to a class</a> +<p> </p> +<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br /> +<br /> +<a href="concept_persistence.htm#BABCAHIC">Understanding Java persistence</a><br /></div> +<!-- class="sect1" --> +<!-- Start Footer --> +<div class="footer"> +<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> +<tr> +<td align="left" width="86%"><a href="dcommon/html/cpyr.htm"><span class="copyrightlogo">Copyright © 2006, 2007, Oracle. All rights reserved.</span></a></td> +</tr> +</table> +</div> +<!-- class="footer" --> +</body> +</html> |