diff options
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.doc.user/getting_started005.htm')
-rw-r--r-- | jpa/plugins/org.eclipse.jpt.doc.user/getting_started005.htm | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started005.htm deleted file mode 100644 index f47329420c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started005.htm +++ /dev/null @@ -1,132 +0,0 @@ -<!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 = January 22, 2008 9:11:14 --> -<meta name="OAC_IGNORE_SKIP_NAV" content="true" /> -<title>Mapping an entity</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 (Mode = ohj/ohw) - Version 5.0" /> -<meta name="date" content="2005-07-10T12:57:20+08:00" /> -<meta name="robots" content="noarchive" /> -<meta name="doctitle" content="Mapping an entity" /> -<meta name="relnum" content="M5 - Release 2.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="BABHACAF" name="BABHACAF"></a></p> -<div class="sect2"><!-- infolevel="all" infotype="General" --> -<h1>Mapping an entity</h1> -<p><a id="sthref17" name="sthref17"></a><a id="sthref18" name="sthref18"></a>This quick start shows how to map fields in a Java persistent entity. Before beginning, add the following fields to the Address class:</p> -<pre xml:space="preserve" class="oac_no_warn"> -private Long id; -private String city; -private String country; -private String stateOrProvince; -private String postalCode; -private String street; -</pre> -<p>Eclipse updates the Address entity in the JPA Structure view to show its fields:</p> -<div class="figure"><a id="sthref19" name="sthref19"></a> -<p class="titleinfigure">Address Entity and Fields</p> -<img src="img/persistence_outline_fields.png" alt="Address entity and its fields in the JPA Structure view." title="Address entity and its fields in the JPA Structure view." /><br /></div> -<!-- class="figure" --> -<p>You will also need to add the following columns to the ADDRESS database table:</p> -<pre xml:space="preserve" class="oac_no_warn"> -NUMBER(10,0) ADDRESS_ID (primary key) -VARCHAR2(80) PROVINCE -VARCHAR2(80) COUNTRY -VARCHAR2(20) P_CODE -VARCHAR2(80) STREET -VARCHAR2(80) CITY -</pre> -<pre xml:space="preserve" class="oac_no_warn"> -</pre> -<p>Now we are ready to map each fields in the Address class to a column in the database table.</p> -<ol start="1"> -<li> -<p>Select the <span class="gui-object-action">id</span> field in the JPA Details view.</p> -</li> -<li> -<p>In the JPA Details view:</p> -<ul> -<li> -<p>For the Map As field, select <span class="bold">Id</span></p> -</li> -<li> -<p>For the Column field, select <span class="bold">ADDRESS_ID</span>.</p> -</li> -</ul> -<div class="figure"><a id="sthref20" name="sthref20"></a> -<p class="titleinfigure">JPA Details View for addressId Field</p> -<img src="img/persistence_view_addressid.png" alt="JPA Details view for the id field." title="JPA Details view for the id field." /><br /></div> -<!-- class="figure" --> -<p>Eclipse adds the following annotations to the Address entity:</p> -<pre xml:space="preserve" class="oac_no_warn"> -@Id -@Column(name="ADDRESS_ID") -</pre></li> -<li> -<p>Map each of the following fields (as <span class="bold">Basic</span> mappings) to the appropriate database column:</p> -<div class="inftblhruleinformal"> -<table class="HRuleInformal" title="This table describes the mappings for each of the fields in the Address entity." summary="This table describes the mappings for each of the fields in the Address entity." 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-t4">Field</th> -<th align="left" valign="bottom" id="r1c2-t4">Map As</th> -<th align="left" valign="bottom" id="r1c3-t4">Database Column</th> -</tr> -</thead> -<tbody> -<tr align="left" valign="top"> -<td align="left" id="r2c1-t4" headers="r1c1-t4">city</td> -<td align="left" headers="r2c1-t4 r1c2-t4">Basic</td> -<td align="left" headers="r2c1-t4 r1c3-t4">CITY</td> -</tr> -<tr align="left" valign="top"> -<td align="left" id="r3c1-t4" headers="r1c1-t4">country</td> -<td align="left" headers="r3c1-t4 r1c2-t4">Basic</td> -<td align="left" headers="r3c1-t4 r1c3-t4">COUNTRY</td> -</tr> -<tr align="left" valign="top"> -<td align="left" id="r4c1-t4" headers="r1c1-t4">postalCode</td> -<td align="left" headers="r4c1-t4 r1c2-t4">Basic</td> -<td align="left" headers="r4c1-t4 r1c3-t4">P_CODE</td> -</tr> -<tr align="left" valign="top"> -<td align="left" id="r5c1-t4" headers="r1c1-t4">provinceOrState</td> -<td align="left" headers="r5c1-t4 r1c2-t4">Basic</td> -<td align="left" headers="r5c1-t4 r1c3-t4">PROVINCE</td> -</tr> -<tr align="left" valign="top"> -<td align="left" id="r6c1-t4" headers="r1c1-t4">street</td> -<td align="left" headers="r6c1-t4 r1c2-t4">Basic</td> -<td align="left" headers="r6c1-t4 r1c3-t4">STREET</td> -</tr> -</tbody> -</table> -<br /></div> -<!-- class="inftblhruleinformal" --></li> -</ol> -<p>Notice that Dali will automatically map some fields to the correct database column (such as the <span class="bold">city</span> field to the CITY column) if the names are identical.</p> -<p>Refer to the <a href="getting_started006.htm#BABCDECJ">Dali basic tutorial</a> to map a complete object model using basic and relational mappings.</p> -</div> -<!-- class="sect2" --> -<!-- 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, 2008, Oracle. All rights reserved.</span></a></td> -</tr> -</table> -</div> -<!-- class="footer" --> -</body> -</html> |