Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm')
-rw-r--r--jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm103
1 files changed, 39 insertions, 64 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm
index 264be579e5..910984a558 100644
--- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm
+++ b/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm
@@ -2,82 +2,57 @@
"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:21 -->
-<meta name="OAC_IGNORE_SKIP_NAV" content="true" />
+<!-- Run date = May 21, 2008 14:42:06 -->
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
-<title>Error messages</title>
+<title>Generating entities from tables</title>
+
<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="Error messages" />
-<meta name="relnum" content="M5 - Release 2.0.0" />
-<meta name="partnum" content="" />
+<meta name="doctitle" content="Generating entities from tables" />
+<meta name="relnum" content="Release 2.0" />
+<meta name="copyright" content="Copyright (c) 2000, 2008 oracle . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html. Contributors: Oracle - initial API and implementation" />
<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="CIHFEDEI" name="CIHFEDEI"></a></p>
-<div class="sect2"><!-- infolevel="all" infotype="General" -->
-<h1>Error messages<a id="sthref168" name="sthref168"></a></h1>
-<p>This section contains information on error messages (including how to resolve the issue) you may encounter while working with Dali.</p>
-<a id="sthref169" name="sthref169"></a>
-<p class="subhead2">Attribute "<span class="italic">&lt;ATTRIBUTE__NAME&gt;</span>" has invalid mapping type in this context</p>
-<p>The mapped attribute is invalid. Either change the mapping type or change the entity type.</p>
-<p>See <a href="task_mapping.htm#BABDGBIJ">"Mapping an entity"</a> for more information.</p>
-<a id="sthref170" name="sthref170"></a>
-<p class="subhead2">Attribute "<span class="italic">&lt;ATTRIBUTE_NAME&gt;</span>" cannot be resolved.</p>
-<p>Dali cannot map the attribute to a database table and column. Verify that you database connection information is correct.</p>
-<p>See <a href="task_create_new_project.htm#CIHHEJCJ">"Creating a new JPA project"</a> for more information.</p>
-<a id="sthref171" name="sthref171"></a>
-<p class="subhead2">Class "<span class="italic">&lt;CLASS_NAME&gt;</span>" is not annotated as a persistent class.</p>
-<p>The class has not been identified as a persistent class. Configure the class as an Entity, Mapped Superclass, or Embeddable persistent entity.</p>
-<p>See <a href="task_add_persistence.htm#BABHICAI">"Adding persistence to a class"</a>.</p>
-<a id="sthref172" name="sthref172"></a>
-<p class="subhead2">Column "<span class="italic">&lt;COLUMN_NAME&gt;</span>" cannot be resolved.</p>
-<p>You mapped an entity's field to an incorrect or invalid column in the database table. By default, Dali will attempt to map each field in the entity with an identically named row in the database table. If the field's name differs from the row's name, you must explicitly create the mapping.</p>
-<p>Map the field to a valid row in the database table as shown in <a href="task_mapping.htm#BABDGBIJ">"Mapping an entity"</a>.</p>
-<a id="sthref173" name="sthref173"></a>
-<p class="subhead2">Duplicate class "<span class="italic">&lt;CLASS_NAME&gt;</span>".</p>
-<p>You created to persistence classes with the same name. Each Java class must have a unique name. See <a href="task_add_persistence.htm#BABHICAI">"Adding persistence to a class"</a> for more information.</p>
-<a id="sthref174" name="sthref174"></a>
-<p class="subhead2">Entity does not have an Id or Embedded Id.</p>
-<p>You created a persistent entity without identifying its primary key. A persistent entity must have a primary key field designated with an <code>@Id</code> or <code>@EmbeddedId</code> annotation.</p>
-<p>Add an ID mapping to the entity as shown in <a href="tasks010.htm#BABGCBHG">"ID mapping"</a> or <a href="tasks009.htm#CIHDIAEE">"Embedded ID mapping"</a>.</p>
-<a id="sthref175" name="sthref175"></a>
-<p class="subhead2">Multiple persistence.xml files in project.</p>
-<p>You created a JPA project with more than one <code>persistence.xml</code> file. Each JPA project must contain a <span class="italic">single</span> <code>persistence.xml</code> file.</p>
-<p>See <a href="task_manage_persistence.htm#CIHDAJID">"Managing the persistence.xml file"</a> for more information.</p>
-<a id="sthref176" name="sthref176"></a>
-<p class="subhead2">No generator named "<span class="italic">&lt;GENERATOR_NAME&gt;</span>" is defined in persistence unit.</p>
-<p>You created a persistence entity that uses sequencing, but did not define a sequence generator in the persistence unit. Either define the generator by using an annotation or including it in the XML mapping file.</p>
-<a id="sthref177" name="sthref177"></a>
-<p class="subhead2">No persistence unit defined.</p>
-<p>There is no persistence unit defined in the <code>persistence.xml</code> file. Use the &lt;persistence-unit name="<span class="italic">&lt;PERSISTENCE_UNIT_NAME&gt;</span>" tag to define the persistent unit.</p>
-<p>See <a href="task_manage_orm.htm#CIHDGDCD">"Managing the orm.xml file"</a> for more information.</p>
-<a id="sthref178" name="sthref178"></a>
-<p class="subhead2">No persistence.xml file in project.</p>
-<p>You created a JPA project without a <code>persistence.xml</code> file. Each JPA project must contain a <span class="italic">single</span> <code>persistence.xml</code> file.</p>
-<p>See <a href="task_manage_persistence.htm#CIHDAJID">"Managing the persistence.xml file"</a> for more information.</p>
-<a id="sthref179" name="sthref179"></a>
-<p class="subhead2">Referenced column "<span class="italic">&lt;COLUMN_NAME&gt;</span>" in join column "<span class="italic">&lt;COLUMN_NAME&gt;</span>" cannot be resolved.</p>
-<p>The column that you selected to join a relationship mapping does not exist on the database table. Either select a different column on the <a href="reference007.htm#CACBAEBC">Join Table Information</a> or create the necessary column on the database table.</p>
-<p>See <a href="ref_persistence_map_view.htm#BABIFBAF">"JPA Details view (for attributes)"</a> for more information.</p>
-<a id="sthref180" name="sthref180"></a>
-<p class="subhead2">Schema "&lt;<span class="italic">SCHEMA_NAME</span>&gt;" cannot be resolved for table/join table "&lt;<span class="italic">TABLE_NAME</span>&gt;".</p>
-<p>Define the default database schema information in the persistence unit.</p>
-<p>See <a href="task_manage_orm.htm#CIHDGDCD">"Managing the orm.xml file"</a> for more information.</p>
-<a id="sthref181" name="sthref181"></a>
-<p class="subhead2">Table "<span class="italic">&lt;TABLE_NAME&gt;</span>" cannot be resolved.</p>
-<p>You associated a persistent entity to an incorrect or invalid database table. By default, Dali will attempt to associate each persistent entity with an identically named database table. If the entity's name differs from the table's name, you must explicitly create the association.</p>
-<p>Associate the entity with a valid database table as shown in <a href="task_add_persistence.htm#BABHICAI">"Adding persistence to a class"</a>.</p>
-<img src="img/ngrelc.png" alt="Related concept" title="Related concept" /><br />
-<p><a href="../org.eclipse.platform.doc.user/concepts/cprbview.htm">Problems view</a></p>
-</div>
-<!-- class="sect2" -->
+<p><a id="BABBAGFI" name="BABBAGFI"></a></p>
+<div class="sect1">
+<h1>Generating entities from tables</h1>
+<p><a id="sthref139" name="sthref139"></a><a id="sthref140" name="sthref140"></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 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="sthref141" name="sthref141"></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>
+<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="sthref142" name="sthref142"></a><a id="sthref143" name="sthref143"></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 tables." title="This figure shows the EMPLOYEE and ADDRESS entities generated from database tables." /><br /></div>
+<!-- class="figure" -->
+<p>&nbsp;</p>
+<img src="img/ngrelt.png" alt="Related task" title="Related task" /><br />
+<p><a href="task_create_new_project.htm#CIHHEJCJ">Creating a new JPA project</a></p>
+<p>&nbsp;</p>
+<img src="img/ngrelr.png" alt="Related reference" title="Related reference" /><br />
+<br />
+<a href="ref_project_properties.htm#BABJHBCI">Project Properties page &ndash; JPA Options</a></div>
+<!-- class="sect1" -->
<!-- Start Footer -->
<div class="footer">
<table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%">

Back to the top