Skip to main content
Jump to: navigation, search

Difference between revisions of "Creating a Relational Project (ELUG)"

m
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Image:Elug draft icon.png]] '''For the latest EclipseLink documentation, please see http://www.eclipse.org/eclipselink/documentation/ '''
 +
 +
----
 +
 
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
 
<div style="margin:5px;float:right;border:1px solid #000000;padding:5px">__TOC__
 
[[Special:Whatlinkshere/Creating a Relational Project (ELUG)|Related Topics]]</div>
 
[[Special:Whatlinkshere/Creating a Relational Project (ELUG)|Related Topics]]</div>
 
+
You can create a project using the Workbench or Java code. We recommend using the Workbench to create projects and generate deployment XML or Java source versions of the project for use at run time. For more information, see the following:
This section describes the various components that you must configure in order to create a relational project.
+
*[[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|How to Create a Project Using the Workbench]]
 
+
*[[Creating%20a%20Project%20(ELUG)#How to Create a Project Using Java|How to Create a Project Using Java]].
For information on how to create more than one type of EclipseLink projects, see [[Creating%20a%20Project%20(ELUG)|Creating a Project]].
+
 
+
 
+
 
+
==Introduction to the Relational Project Creation==
+
 
+
You can create a project using the Workbench or Java code.
+
 
+
We recommend using the Workbench to create projects and generate deployment XML or Java source versions of the project for use at run time. For more information on how to create a project using Workbench, see [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|How to Create a Project Using the Workbench]]. For information on how to create a project using Java, see [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using Java|How to Create a Project Using Java]].
+
  
 
You can use EclipseLink to create a relational project, if any of the following conditions are met:
 
You can use EclipseLink to create a relational project, if any of the following conditions are met:
 
 
* You have both an object and data model: see [[#Creating a Project from an Existing Object and Data Model|Creating a Project from an Existing Object and Data Model]].
 
* You have both an object and data model: see [[#Creating a Project from an Existing Object and Data Model|Creating a Project from an Existing Object and Data Model]].
 
* You have an object model, but no data model yet: see [[#Creating a Project from an Existing Object Model|Creating a Project from an Existing Object Model]].
 
* You have an object model, but no data model yet: see [[#Creating a Project from an Existing Object Model|Creating a Project from an Existing Object Model]].
 
* You have a data model, but no object model yet: [[#Creating a Project from an Existing Data Model|Creating a Project from an Existing Data Model]].
 
* You have a data model, but no object model yet: [[#Creating a Project from an Existing Data Model|Creating a Project from an Existing Data Model]].
 
  
 
For more information, see [[Introduction%20to%20Relational%20Projects%20(ELUG)|Introduction to Relational Projects]].
 
For more information, see [[Introduction%20to%20Relational%20Projects%20(ELUG)|Introduction to Relational Projects]].
Line 26: Line 19:
  
 
==Creating a Project from an Existing Object and Data Model==
 
==Creating a Project from an Existing Object and Data Model==
 
 
If you have both an existing object model (Java classes for your domain objects) and data model (such as an existing database schema), use this procedure to create your EclipseLink project.
 
If you have both an existing object model (Java classes for your domain objects) and data model (such as an existing database schema), use this procedure to create your EclipseLink project.
 
  
  
 
===How to Create a Project from an Existing Object and Data Model Using Workbench===
 
===How to Create a Project from an Existing Object and Data Model Using Workbench===
 
+
# [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|Create the project]].
# Create the project (see [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|How to Create a Project Using the Workbench]]).
+
# [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configure the project classpath]].
# Configure the project classpath (see [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configuring Project Classpath]]).
+
# [[Using%20Workbench%20(ELUG)#How to Import and Update Classes|Import classes]].
# Import classes (see [[Using%20Workbench%20(ELUG)#How to Import and Update Classes|How to Import and Update Classes]]).
+
# [[Using%20Workbench%20(ELUG)#Importing Tables from a Database|Import database tables]].
# Import database tables (see [[Using%20Workbench%20(ELUG)#Importing Tables from a Database|Importing Tables from a Database]]).
+
# [[Creating%20a%20Mapping%20(ELUG)#How to Create Mappings Automatically During Development Using Workbench|Automatically create mappings]].
# Automatically create mappings (see [[Creating%20a%20Mapping%20(ELUG)#How to Create Mappings Automatically During Development Using Workbench|How to Create Mappings Automatically During Development Using Workbench]]).
+
# [[Configuring%20a%20Project%20(ELUG)|Configure project options]].
# Configure project options (see [[Configuring%20a%20Project%20(ELUG)|Configuring a Project]]).
+
 
+
  
  
 
==Creating a Project from an Existing Object Model==
 
==Creating a Project from an Existing Object Model==
 
 
If you have an existing object model (Java classes for your domain objects), but you do not have a corresponding data model, use this procedure to create your EclipseLink project and automatically generate the corresponding data model.
 
If you have an existing object model (Java classes for your domain objects), but you do not have a corresponding data model, use this procedure to create your EclipseLink project and automatically generate the corresponding data model.
 
  
  
 
===How to Create a Project from an Existing Object Model Using Workbench===
 
===How to Create a Project from an Existing Object Model Using Workbench===
 
+
# [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|Create the project]].
# Create the project (see [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|How to Create a Project Using the Workbench]]).
+
# [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configure the project classpath]].
# Configure the project classpath (see [[Configuring%20a%20Project%20(ELUG)#Configuring Project Classpath|Configuring Project Classpath]]).
+
# [[Using%20Workbench%20(ELUG)#How to Import and Update Classes|Import classes]].
# Import classes (see [[Using%20Workbench%20(ELUG)#How to Import and Update Classes|How to Import and Update Classes]]).
+
 
# Generate database tables. For more information, see the following:
 
# Generate database tables. For more information, see the following:
 
#* [[Using%20Workbench%20(ELUG)#Creating New Tables|Creating New Tables]]
 
#* [[Using%20Workbench%20(ELUG)#Creating New Tables|Creating New Tables]]
Line 58: Line 44:
 
#* [[Configuring%20a%20Relational%20Project%20(ELUG)|How to Configure Table Creator Java Source Options Using Workbench]]
 
#* [[Configuring%20a%20Relational%20Project%20(ELUG)|How to Configure Table Creator Java Source Options Using Workbench]]
 
#* [[#How to Export Table Creator Files Using Workbench|How to Export Table Creator Files Using Workbench]]
 
#* [[#How to Export Table Creator Files Using Workbench|How to Export Table Creator Files Using Workbench]]
# Configure project options (see [[Configuring%20a%20Project%20(ELUG)|Configuring a Project]]).
+
# [[Configuring%20a%20Project%20(ELUG)|Configure project options]].
  
  
  
 
==Creating a Project from an Existing Data Model==
 
==Creating a Project from an Existing Data Model==
 
 
If you have an existing data model (such as a database schema), but you do not have a corresponding data model (Java classes for domain objects), use this procedure to create your EclipseLink project and automatically generate the corresponding object model.
 
If you have an existing data model (such as a database schema), but you do not have a corresponding data model (Java classes for domain objects), use this procedure to create your EclipseLink project and automatically generate the corresponding object model.
 
  
  
 
===How to Create a Project from an Existing Data Model Using Workbench===
 
===How to Create a Project from an Existing Data Model Using Workbench===
 
+
# [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|Create the project]].
# Create the project (see [[Creating%20a%20Project%20(ELUG)#How to Create a Project Using the Workbench|How to Create a Project Using the Workbench]]).
+
# [[Using%20Workbench%20(ELUG)#Importing Tables from a Database|Import database tables]].
# Import database tables (see [[Using%20Workbench%20(ELUG)#Importing Tables from a Database|Importing Tables from a Database]]).
+
# [[Using%20Workbench%20(ELUG)#Generating Classes and Descriptors from Database Tables|Generate classes]].
# Generate classes. For more information, see either of the following:
+
# [[Configuring%20a%20Project%20(ELUG)#Configuring a Project|Configure project options]].
#* [[Using%20Workbench%20(ELUG)#Generating Classes and Descriptors from Database Tables|Generating Classes and Descriptors from Database Tables]]
+
# Configure project options (see [[Configuring%20a%20Project%20(ELUG)#Configuring a Project|Configuring a Project]]).
+
  
  
  
 
==Exporting Project Information==
 
==Exporting Project Information==
 
 
Workbench generates and exports the following project information:
 
Workbench generates and exports the following project information:
 
+
* [[#How to Export Project Java Source Using Workbench|Project Java source]]
* [[#How to Export Project Java Source Using Workbench|Project Java source]])
+
* [[#How to Export Table Creator Files Using Workbench|Table creator files]]
* [[#How to Export Table Creator Files Using Workbench|Table creator files]])
+
 
+
  
  
 
===How to Export Project Java Source Using Workbench===
 
===How to Export Project Java Source Using Workbench===
 
 
For relational projects only, you can convert the project to Java source code. Generally, the generated code executes faster and deploys easier than XML files. See [[Creating%20a%20Descriptor%20(ELUG)#Generating Java Code for Descriptors|Generating Java Code for Descriptors]] to export the model source for a ''specific descriptor'' in a project. To convert your relational project to Java source, use this procedure:
 
For relational projects only, you can convert the project to Java source code. Generally, the generated code executes faster and deploys easier than XML files. See [[Creating%20a%20Descriptor%20(ELUG)#Generating Java Code for Descriptors|Generating Java Code for Descriptors]] to export the model source for a ''specific descriptor'' in a project. To convert your relational project to Java source, use this procedure:
  
# Right-click the project in the '''Navigator''' and choose '''Export''' > '''Project Java Source''' from the context menu.[[Image:expjava.gif|Export to Java Source button]]<br /> You can also choose '''Workbench''' > '''Export''' > '''Export Java Source''' or '''Selected''' > '''Export''' > '''Project Java Source''' from the menu. If you have not defined deployment and source code generation defaults (see [[Configuring%20a%20Project%20(ELUG)|Configuring a Project]]) Workbench prompts for a project class name and directory.
+
# Right-click the project in the '''Navigator''' and choose '''Export''' > '''Project Java Source''' from the context menu.[[Image:expjava.gif|Export to Java Source button]]<br /> You can also choose '''Workbench''' > '''Export''' > '''Export Java Source''' or '''Selected''' > '''Export''' > '''Project Java Source''' from the menu. If you have not defined deployment and source code generation defaults (see [[Configuring%20a%20Project%20(ELUG)|Configuring a Project]]), Workbench prompts for a project class name and directory.
  
<br />
 
  
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
{| class="Note oac_no_warn" width="80%" border="1" frame="hsides" rules="groups" cellpadding="3" frame="hsides" rules="groups"
 
| align="left" |
 
| align="left" |
'''''Note''''' If your Workbench project uses the UTF-8 character set, you must use a compatible JDK when compiling the exported Java source. If your project contains errors, the <tt>project.xml</tt> file may not be valid. See for information on each reported error.
+
'''''Note:''''' If your Workbench project uses the UTF-8 character set, you must use a compatible JDK when compiling the exported Java source. If your project contains errors, the <tt>project.xml</tt> file may not be valid. See [[Troubleshooting an EclipseLink Application (ELUG)|Troubleshooting an EclipseLink Application]] for information on each reported error.
 
|}
 
|}
 
 
 
  
  
 
===How to Export Table Creator Files Using Workbench===
 
===How to Export Table Creator Files Using Workbench===
 
 
For relational projects only, you can create Java source code to generate database tables defined in the project using this procedure:
 
For relational projects only, you can create Java source code to generate database tables defined in the project using this procedure:
  
Line 121: Line 94:
  
 
[[Category: EclipseLink User's Guide]]
 
[[Category: EclipseLink User's Guide]]
[[Category: Draft]]
+
[[Category: Release 1]]
 
[[Category: Task]]
 
[[Category: Task]]
 +
[[Category: ORM]]

Latest revision as of 10:25, 18 July 2012

Elug draft icon.png For the latest EclipseLink documentation, please see http://www.eclipse.org/eclipselink/documentation/


You can create a project using the Workbench or Java code. We recommend using the Workbench to create projects and generate deployment XML or Java source versions of the project for use at run time. For more information, see the following:

You can use EclipseLink to create a relational project, if any of the following conditions are met:

For more information, see Introduction to Relational Projects.


Creating a Project from an Existing Object and Data Model

If you have both an existing object model (Java classes for your domain objects) and data model (such as an existing database schema), use this procedure to create your EclipseLink project.


How to Create a Project from an Existing Object and Data Model Using Workbench

  1. Create the project.
  2. Configure the project classpath.
  3. Import classes.
  4. Import database tables.
  5. Automatically create mappings.
  6. Configure project options.


Creating a Project from an Existing Object Model

If you have an existing object model (Java classes for your domain objects), but you do not have a corresponding data model, use this procedure to create your EclipseLink project and automatically generate the corresponding data model.


How to Create a Project from an Existing Object Model Using Workbench

  1. Create the project.
  2. Configure the project classpath.
  3. Import classes.
  4. Generate database tables. For more information, see the following:
  5. Configure project options.


Creating a Project from an Existing Data Model

If you have an existing data model (such as a database schema), but you do not have a corresponding data model (Java classes for domain objects), use this procedure to create your EclipseLink project and automatically generate the corresponding object model.


How to Create a Project from an Existing Data Model Using Workbench

  1. Create the project.
  2. Import database tables.
  3. Generate classes.
  4. Configure project options.


Exporting Project Information

Workbench generates and exports the following project information:


How to Export Project Java Source Using Workbench

For relational projects only, you can convert the project to Java source code. Generally, the generated code executes faster and deploys easier than XML files. See Generating Java Code for Descriptors to export the model source for a specific descriptor in a project. To convert your relational project to Java source, use this procedure:

  1. Right-click the project in the Navigator and choose Export > Project Java Source from the context menu.Export to Java Source button
    You can also choose Workbench > Export > Export Java Source or Selected > Export > Project Java Source from the menu. If you have not defined deployment and source code generation defaults (see Configuring a Project), Workbench prompts for a project class name and directory.


Note: If your Workbench project uses the UTF-8 character set, you must use a compatible JDK when compiling the exported Java source. If your project contains errors, the project.xml file may not be valid. See Troubleshooting an EclipseLink Application for information on each reported error.


How to Export Table Creator Files Using Workbench

For relational projects only, you can create Java source code to generate database tables defined in the project using this procedure:

  1. Right-click the project in the Navigator and choose Export > Table Creator Java Source from the context menu.You can also choose Workbench > Export > Table Creator Java Source or Selected > Export > Table Creator Java Source from the menu.

If you have not defined deployment and source code generation defaults (see Configuring a Project) Workbench prompts for a class name and root directory.




Copyright Statement

Copyright © Eclipse Foundation, Inc. All Rights Reserved.