Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: f78f1a6eff92baa27cdf1fd0ca37d37d141ff3cd (plain) (tree)









































































                                                                                                                                                                                                                                                                                                                                                                                                                 
<!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:11 -->
<meta name="OAC_IGNORE_SKIP_NAV" content="true" />
<title>Generating entities from tables</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="Generating entities from tables" />
<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="BABBAGFI" name="BABBAGFI"></a></p>
<div class="sect1">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">
<tr valign="bottom">
<td align="left" width="86%">
<h1>Generating entities from tables</h1>
</td>
</tr>
</table>
<p><a id="sthref154" name="sthref154"></a><a id="sthref155" name="sthref155"></a>Use this procedure to generate Java persistent entities from database tables. You must create a JPA project and establish a database connection <span class="italic">before</span> generating persistent entities. See <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a> for more information.</p>
<ol type="1" start="1">
<li>
<p>Right-click the JPA project in the <span class="gui-object-title">Package Explorer</span> and select <span class="gui-object-action">JPA Tools &gt; Generate Entities</span>.</p>
<div class="figure"><a id="sthref156" name="sthref156"></a>
<p class="titleinfigure">Generating Entities</p>
<img src="img/generate_entities.png" alt="Using the Java Persistence &gt; Generate Entities menu option." title="Using the Java Persistence &gt; Generate Entities menu option." /><br /></div>
<!-- class="figure" --></li>
<li>
<p>If you are not currently connected to the database, the Database Connection page appears. Select your database connection and schema, and click <span class="bold">Reconnect</span>.</p>
<p>To create a new database connection, click <span class="bold">Add connection</span>.</p>
<p>After connecting to the database, click <span class="bold">Next</span>.</p>
</li>
<li>
<p><a id="sthref157" name="sthref157"></a><a id="sthref158" name="sthref158"></a>On the <a href="task_generate_entities.htm#CACDAFJD">Generate Entities from Tables dialog</a> dialog, select the tables from which to generate Java persistent entities and click <span class="bold">Finish</span>.</p>
</li>
</ol>
<p>Eclipse creates a Java persistent entity for each database table. Each entity contains fields based on the table's columns. Eclipse will also generate entity relationships (such as one-to-one) based on the table constraints. <a href="#CIHJIJJC">Figure: Generating Entities from Tables</a> illustrates how Eclipse generates entities from tables.</p>
<div class="figure"><a id="CIHJIJJC" name="CIHJIJJC"></a>
<p class="titleinfigure">Generating Entities from Tables</p>
<img src="img/table_entity.png" alt="This figure shows the EMPLOYEE and ADDRESS entities generated from database tabels." title="This figure shows the EMPLOYEE and ADDRESS entities generated from database tabels." /><br /></div>
<!-- class="figure" -->
<p>&nbsp;</p>
<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
<br />
<p>&nbsp;</p>
<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
<br />
<p>&nbsp;</p>
<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
<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&nbsp;&copy;&nbsp;2006, 2007,&nbsp;Oracle.&nbsp;All&nbsp;rights&nbsp;reserved.</span></a></td>
</tr>
</table>
</div>
<!-- class="footer" -->
</body>
</html>

Back to the top