Difference between revisions of "JPA Diagram Editor Project Tutorial"

From Eclipsepedia

Jump to: navigation, search
m (Add new Attribute)
m
Line 31: Line 31:
  
 
[[Image:CreateEntity.jpg]]
 
[[Image:CreateEntity.jpg]]
 +
 +
== Rename Entity ==
 +
 +
In the Eclipse IDE create new JPA 1.0 project. Open its diagram editor and create new entity. For more information how to create new entity follow the steps described in the previous section [http://wiki.eclipse.org/JPA_Diagram_Editor_Project_Tutorial#Create_new_Entity Create new Entity].
 +
There are two ways to rename entity:
 +
* Select entity and click on its header name - this is the so called direct editing
 +
* Select entity and from its context menu select '''''Refactor Entity Class -> Rename...'''''
  
 
== Add new Attribute  ==
 
== Add new Attribute  ==

Revision as of 02:25, 17 August 2010

Contents

Overview

This tutorial provides a step by step walk-through of the Java Diagram Editor.

Prerequisites

This tutorial is based on the Eclipse Helios.

To install JPA Diagram Editor project follow the steps described in How to Install section of the JPA Diagram Editor wiki main page.

Open JPA Diagram Editor

In the Eclipse IDE create new JPA 1.0 project.

The Open Diagram action is available on two levels:

  • On project level: Select the newly created JPA project and from its context menu select JPA Tools -> Open Diagram

OpenDiagramOnProjectLevel.jpg

  • On JPA node level: Expand the newly created JPA project and from the context menu of its JPA node, select Open Diagram

OpenDiagramOnJPANodeLevel.jpg

Create new Entity

In the Eclipse IDE create new JPA 1.0 project. Download the persistence provider library and add it into the JPA project's classpath.

Open the JPA Diagram Editor. For more information how to do this, follow the steps described in the previous section Open JPA Diagram Editor.

From the right site of the editor, the so called Palette section, select Java Entity and drag&drop it to the diagram. A new entity class org.persistence.Entity1 with default primary key attribute should be created and shown in the diagram:

CreateEntity.jpg

Rename Entity

In the Eclipse IDE create new JPA 1.0 project. Open its diagram editor and create new entity. For more information how to create new entity follow the steps described in the previous section Create new Entity. There are two ways to rename entity:

  • Select entity and click on its header name - this is the so called direct editing
  • Select entity and from its context menu select Refactor Entity Class -> Rename...

Add new Attribute

In the Eclipse IDE create new JPA 1.0 project. Open its diagram editor and create new entity. For more information how to create new entity follow the steps described in the previous section Create new Entity. Select the newly created entity or just place the mouse over it and select from its context buttons Create Attribute:

CreateAttribute.jpg

A new attribute named Attribute1 should be added under section Other Attributes:

AddAttribute.jpg