Skip to main content
blob: 5ed4fec42de3d25e78b87f5dd4e49de7a6f01b46 (plain) (tree)





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
<!-- Run date = May 15, 2007 9:04:26 -->
<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="" />
<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" />
<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>
<p><a id="sthref158" name="sthref158"></a><a id="sthref159" name="sthref159"></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">
<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="sthref160" name="sthref160"></a>
<p class="titleinfigure">Generating Entities</p>
<img src="img/generate_entities.png" alt="Using the JPA Tools &gt; Generate Entities menu option." title="Using the JPA Tools &gt; Generate Entities menu option." /><br /></div>
<!-- class="figure" --></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>
<p><a id="sthref161" name="sthref161"></a><a id="sthref162" name="sthref162"></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>
<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" -->
<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
<br />
<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
<br />
<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%">
<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>
<!-- class="footer" -->

Back to the top