<!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> | |
<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" /> | |
<title>Generating tables from entities</title> | |
<meta name="generator" content="Oracle DARB XHTML Converter (Mode = document) - Version 1.0.11" /> | |
<meta name="date" content="2012-12-19T9:17:44Z" /> | |
<meta name="robots" content="noarchive" /> | |
<meta name="doctitle" content="Generating tables from entities" /> | |
<meta name="relnum" content="Release 3.2" /> | |
<meta name="partnum" content="Release 3.2" /> | |
<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="contents" href="toc.htm" title="Contents" type="text/html" /> | |
<link rel="up" href="../../index.htm" title="Home" type="text/html" /> | |
<link rel="up" href="toc.htm" title="User Guide" type="text/html" /> | |
<link rel="up" href="tasks.htm" title="Tasks" type="text/html" /> | |
<link rel="up" href="tasks007.htm" title="Generating tables from enti..." type="text/html" /> | |
<link rel="index" href="index.htm" title="Index" type="text/html" /> | |
<link rel="prev" href="tasks006.htm" title="Generating entities from tables " type="text/html" /> | |
<link rel="next" href="tasks008.htm" title="Generating dynamic entities from tables" type="text/html" /> | |
</head> | |
<body> | |
<div class="header"><a id="top" name="top"></a> | |
<div class="zz-skip-header"><a href="#BEGIN">Skip Headers</a></div> | |
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> | |
<tr> | |
<td align="left" valign="top"><b>Dali Java Persistence Tools User Guide</b><br /> | |
<b>Release 3.2</b><br /> | |
Release 3.2</td> | |
<td valign="bottom" align="right"> | |
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225"> | |
<tr> | |
<td> </td> | |
<td align="center" valign="top"><a href="../dali_user_guide.pdf"><img src="dcommon/gifs/pdf_icon.png" alt="PDF" height="24" /><br /><span class="icon">PDF</span></a></td><td align="center" valign="top"><a href="toc.htm"><img src="dcommon/gifs/toc.gif" alt="Go To Table Of Contents" /><br /> | |
<span class="icon">Contents</span></a></td> | |
<td align="center" valign="top"><a href="index.htm"><img src="dcommon/gifs/index.gif" alt="Go To Index" /><br /> | |
<span class="icon">Index</span></a></td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
<hr /> | |
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100"> | |
<tr> | |
<td align="center"><a href="tasks006.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> | |
<span class="icon">Generating entities from tables</span></a> </td> | |
<td align="center"><a href="tasks008.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> | |
<span class="icon">Generating dynamic entities from tables</span></a></td> | |
<td> </td> | |
</tr> | |
</table> | |
<p id="BREADCRUMBING"><a href="../../index.htm" title="Home">Home</a> > <a href="toc.htm" title="User Guide">User Guide</a> > <a href="tasks.htm" title="Tasks">Tasks</a> > Generating tables from enti...</p> | |
<a name="BEGIN" id="BEGIN"></a></div> | |
<!-- class="header" --> | |
<div class="ind"><!-- End Header --><a id="CIHJIGBE" name="CIHJIGBE"></a> | |
<div class="sect1"><!-- infolevel="all" infotype="General" --> | |
<h1 class="sect1">Generating tables from entities</h1> | |
<p><a id="sthref301" name="sthref301"></a><a id="sthref302" name="sthref302"></a><a id="sthref303" name="sthref303"></a>When using a vendor-specific platform, you can create a DDL script from your persistent entities.</p> | |
<div align="center"> | |
<div class="inftblnote"><br /> | |
<table class="Note oac_no_warn" summary="" border="1" width="80%" frame="hsides" rules="groups" cellpadding="3" cellspacing="0"> | |
<tbody> | |
<tr> | |
<td align="left"> | |
<p class="notep1">Note:</p> | |
<p>The DDL script will <code>DROP</code> existing tables on the database and <code>CREATE</code> new tables, based on the entities in your project.</p> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<br /></div> | |
<!-- class="inftblnote" --></div> | |
<p>To generate a DDL script:</p> | |
<ol> | |
<li> | |
<p>Right-click the JPA project in the <span class="gui-object-title">Project Explorer</span> and select <span class="gui-object-action">JPA Tools > Generate Tables from Entities</span>.</p> | |
<img src="img/generate_tables_from_entities.png" alt="JPA Tools > Generate Tables from Entities" title="JPA Tools > Generate Tables from Entities" /><br /></li> | |
<li> | |
<p>On the <a href="reference001.htm#CACHAJEG">Schema Generation</a> page, select the generation output mode.</p> | |
<div class="figure"><a id="sthref304" name="sthref304"></a> | |
<p class="titleinfigure">Figure 3-67 Schema Generation</p> | |
<img src="img/generate_tables.png" alt="" title="" /><br /></div> | |
<!-- class="figure" --></li> | |
<li> | |
<p>Click <span class="bold">Finish</span>. Dali generates the selected DDL for the entities, as shown in <a href="#CIHJAHAC">Example 3-3</a>.</p> | |
</li> | |
</ol> | |
<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> | |
<div class="example"><a id="CIHJAHAC" name="CIHJAHAC"></a> | |
<p class="titleinexample">Example 3-3 Sample Generated Output</p> | |
<pre xml:space="preserve" class="oac_no_warn"> | |
[EL Config]: metadata: The access type for the persistent class [class quickstart.demo.model.Address] is set to [FIELD]. | |
[EL Config]: metadata: The alias name for the entity class [class quickstart.demo.model.Address] is being defaulted to: Address. | |
[EL Config]: metadata: The table name for entity [class quickstart.demo.model.Address] is being defaulted to: ADDRESS. | |
[EL Config]: metadata: The column name for element [street] is being defaulted to: STREET. | |
[EL Config]: metadata: The column name for element [city] is being defaulted to: CITY. | |
[EL Config]: metadata: The column name for element [country] is being defaulted to: COUNTRY. | |
[EL Info]: EclipseLink, version: Eclipse Persistence Services - 2.4.0.vXXXX | |
[EL Fine]: connection: Detected database platform: org.eclipse.persistence.platform.database.JavaDBPlatform | |
[EL Config]: connection: Connection(7896086)--connecting(DatabaseLogin( | |
platform=>JavaDBPlatform | |
user name=> "" | |
datasource URL=> "jdbc:derby:C:\MyDB;create=true" | |
)) | |
[EL Config]: connection: Connection(28523022)--Connected: jdbc:derby:C:\MyDB | |
User: APP | |
Database: Apache Derby Version: 10.9.1.0 - (XXXX) | |
Driver: Apache Derby Embedded JDBC Driver Version: 10.9.1.0 - (XXXX) | |
[EL Config]: connection: Connection(27817788)--connecting(DatabaseLogin( | |
platform=>JavaDBPlatform | |
user name=> "" | |
datasource URL=> "jdbc:derby:C:\MyDB;create=true" | |
)) | |
[EL Config]: connection: Connection(11557581)--Connected: jdbc:derby:C:\MyDB | |
User: APP | |
Database: Apache Derby Version: 10.9.1.0 - (XXXX) | |
Driver: Apache Derby Embedded JDBC Driver Version: 10.9.1.0 - (XXXX) | |
[EL Info]: connection: file:/C:/workspace/runtime-EclipseApplication/QuickStart/build/classes/_QuickStart_url=jdbc:derby:C:\MyDB;create=true login successful | |
[EL Fine]: sql: Connection(28523022)--DROP TABLE ADDRESS | |
[EL Fine]: sql: Connection(28523022)--CREATE TABLE ADDRESS (ADDRESS_ID BIGINT NOT NULL, CITY VARCHAR(255), COUNTRY VARCHAR(255), P_CODE VARCHAR(255), PROVINCE VARCHAR(255), STREET VARCHAR(255), PRIMARY KEY (ADDRESS_ID)) | |
[EL Config]: connection: Connection(28523022)--disconnect | |
[EL Info]: connection: file:/C://workspace/runtime-EclipseApplication/QuickStart/build/classes/_QuickStart_url=jdbc:derby:C:\MyDB;create=true logout successful | |
[EL Config]: connection: Connection(7896086)--disconnect | |
[EL Config]: connection: Connection(11557581)--disconnect | |
</pre></div> | |
<!-- class="example" --> | |
<a id="sthref305" name="sthref305"></a> | |
<p class="subhead2">Related tasks</p> | |
<ul> | |
<li> | |
<p><a href="task_create_jpa_entity.htm#BABFBJBG">Creating a JPA entity</a></p> | |
</li> | |
</ul> | |
<a id="sthref306" name="sthref306"></a> | |
<p class="subhead2">Related reference</p> | |
<ul> | |
<li> | |
<p><a href="reference003.htm#BABJHBCI">Project Properties page – JPA</a></p> | |
</li> | |
</ul> | |
</div> | |
<!-- class="sect1" --></div> | |
<!-- class="ind" --> | |
<!-- Start Footer --> | |
<div class="footer"> | |
<hr /> | |
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> | |
<col width="33%" /> | |
<col width="*" /> | |
<col width="33%" /> | |
<tr> | |
<td valign="bottom"> | |
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100"> | |
<col width="*" /> | |
<col width="48%" /> | |
<col width="48%" /> | |
<tr> | |
<td> </td> | |
<td align="center"><a href="tasks006.htm"><img src="dcommon/gifs/leftnav.gif" alt="Previous" /><br /> | |
<span class="icon">Generating entities from tables</span></a> </td> | |
<td align="center"><a href="tasks008.htm"><img src="dcommon/gifs/rightnav.gif" alt="Next" /><br /> | |
<span class="icon">Generating dynamic entities from tables</span></a></td> | |
</tr> | |
</table> | |
</td> | |
<td class="copyrightlogo"><img class="copyrightlogo" src="http://www.eclipse.org/eclipse.org-common/themes/Nova/images/eclipse.png" alt="Eclipse Logo" width="150"/><br /> | |
<span class="copyrightlogo">Copyright © 2011, 2012, by The Eclipse Foundation under the Eclipse Public License (EPL).</span> <a href="legal.htm"><br /> | |
<span class="copyrightlogo">Legal Notices</span></a></td> | |
<td valign="bottom" align="right"> | |
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225"> | |
<tr> | |
<td> </td> | |
<td align="center" valign="top"><a href="../dali_user_guide.pdf"><img src="dcommon/gifs/pdf_icon.png" alt="PDF" height="24" /><br /><span class="icon">PDF</span></a></td><td align="center" valign="top"><a href="toc.htm"><img src="dcommon/gifs/toc.gif" alt="Go To Table Of Contents" /><br /> | |
<span class="icon">Contents</span></a></td> | |
<td align="center" valign="top"><a href="index.htm"><img src="dcommon/gifs/index.gif" alt="Go To Index" /><br /> | |
<span class="icon">Index</span></a></td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
</div> | |
<!-- class="footer" --> | |
</body> | |
</html> |