Sei sulla pagina 1di 16

MyEclipse ER-Designer Quickstart

Last Revision: January 24, 2006

Outline
1. Preface
2. Requirements
3. Introduction
4. Creating an ER Diagram from a Database
5. Working with an Entity-Relationship Diagram
1. Notation and Presentation Basics
2. Refreshing Table and ER Diagram Data
3. Relationship Routing and Rerouting
4. Visual Grid, Table Alignment, Table Resizing
5. Locating and Selecting Tables
6. Exporting an ER Diagram
7. Configuring The ER-Designer
8. Summary
9. User Feedback
10.References

1. Preface
This document was written using Sun JDK 1.4.2, Eclipse 3.1, MyEclipse 4.0 and MyEclipse Database Explorer with a
demonstration Oracle9i server. All screenshots are based upon the default user interface settings for Eclipse,
MyEclipse Enterprise Workbench, and Windows XP. If you experience difficulty with the instruction of this document,
please see the User Feedback section for how to provide feedback to the MyEclipse documentation team.

Back to Top

2. Requirements
Below is a list of requirements for this Quickstart:

1. Java 2 SDK, Standard Edition 1.4 or later installed (see Resources for a download link)
2. Eclipse 3.1 SDK (see Resources for a download link)
3. MyEclipse 4.0 (see Resources for a download link)
4. A database server that is supported by the MyEclipse Database Explorer
5. The MyEclipse Database Explorer configured to browse a sample database

Back to Top
3. Introduction
The MyEclipse ER-Designer is a maturing feature set that will ultimately enable developers to visually manage the full
life-cycle of a relational database from design, through implementation, and maintenance. The MyEclipse ER-Designer
is the initial public version and its features are limited to providing a visual model of existing databases. The ER-
Designer utilizes the database connectors of the Database Explorer to access a database's metadata as it reverse
engineers the database's entity-relationship (ER) model. From that, the ER-Designer renders the model using the
Information Engineering (IE) System for ER as an entity-relation diagram (ERD). At any time the ER-Designer can
resynchronize an ERD with its database to accurately reflect the current state of the database. The ER-Design includes
a sophisticated table and relationship layout engine that enables it to quickly layout/relayout an ERD.

Figure 1. MyEclipse Database Explorer Perspective

The ER-Designer provides numerous tools and features that enable you to create, reorganize and customize an ER,
and to export the ER as a JPEG image. This Quickstart will demonstrate how to use these tools to accomplish the
following tasks:

1. Reverse engineer an entity-relation diagram (ERD) from a database


2. Reposition and resize tables and reroute relationships
3. Automatic layout of an ERD table and nodes
4. Export an ERD diagram as a JPEG image
5. Resynchronize individual tables or an entire ERD with its source database
6. Customize the ER-Designer's look and feel

Back to Top

4. Creating an ER Diagram from a Database


This section demonstrates how to create ERD from an existing database. The example presented uses the Oracle 9i
Human Resources (HR) example database.

1. Open the Database Explorer perspective. From the menubar select Window > Open Perspective > Other... >
MyEclipse Database Explorer
2. From the Database Browser view select the database or schema for which to create an ER diagram
3. From the context-menu (right-click) select the Create ER Diagram action (see Figure 2).

Figure 2. Creating an entity-relation diagram from a database

4. From the New ER Diagram File Wizard, select the project and specify the name of the new ER diagram file.
Note that the ".mer" is the default file extension used by the ER Designer . If your workspace has no
projects, the Projects list will be empty and you will need to cancel the process, create a project, and then
resume this process.

Figure 3. New ER diagram location selection

5. In the New ER Diagram wizard select OK to initiate the database analysis and diagram creation process.

Reverse engineering an ER diagram from a database requires that the ER-Designer download and
analyze the database's metadata. Depending upon the size of your database and the DB server
connection performance, the metadata retrieval process could be time consuming. Therefore you may
choose to run the process in the background by selecting the Run in Background action in the ERD
creation monitor (see Figure 4).

Figure 4. Progress Monitor while accessing database meta

Upon completion of the process the new HR.mer file has been created.
Figure 5. Workbench with newly created HR.mer file

Back to Top

5 Working With An ER Diagram


This section demonstrates use of the basic ER-Designer features with the HR.mer ERD file created in Section 4.

Back to Top

5.1 Notation and Presentation Basics

The ER-Designer supports the Information Engineering for ER notation, a.k.a., crows feet notation. During the reverse
engineering process only the cardinality of the child entity of a parent-child relationship is depicted. Figure 6 depicts an
annotated relation. Notice that the details compartment of a table defines each table column, the column's type, and its
role, such as a primary or foreign key. Table 1 defines the meaning of the icons and text styles used in the table details
compartment.

Tables

Tables may be repositioned to any location on the ER-Designer by selecting a table and dragging it to a new location.
Any relocation operation may be reversed using the Eclipse UNDO command or its equivalent keyboard short-cut (e.g.,
ctrl-z). When a table is selected it is presented with a distinct highlighted background color. In Figure 6, the JOBS table
appears as a selected table.

Figure 6. Example entity relationship

Table 1. ER-Designer Table Index

Example Table Symbol/Text Style Value

underlined text + or Primary Key

or Foreign Key

bold text Not NULL constraint

normal text NULL-able

Expand/Collapse details
/
compartment

Relationships

A relationship is depicted as a directed, labeled connection between 2 database table entities. The connection's label is
based on the pattern: parentTable(column1,...)= childTable(column1,...) mapping. Next to the relationship label is a
direction arrow that points from the parent table to the child table (->). When you fly-over a connection, the foreign key
constraint name is displayed. For example the JHIST_JOB_FK constraint is depicted in Figure 6 just below the relation
in bright blue text.

Table 2. ER-Designer Relationship Annotations

Example Schema Symbol Description


One and only one

One or more

Zero or more

Zero or one

Back to Top

5.2 Refreshing Table and ER Diagram Data

An ER diagram can be refreshed (i.e., resynchronized) with the current state of the database from which it was derived.
The refresh process involves retrieving database metadata and reconciling it with the state of the ER diagram. ER
diagram refreshing can be performed on selected tables or the entire diagram can be refreshed.

Refreshing Table Data

1. Select 1 or more tables to refresh


2. From the context-menu (right-click menu) select the Refresh Table action
3. The ER-Designer will interact with the Database Explorer to retrieve the metadata for the selected tables and
update the diagram

Figure 7. Refresh Table context menu action

Refreshing an Entire ER Diagram

1. Deselect all tables


2. From the menubar select View > Refresh Diagram
3. The ER-Designer will interact with the Database Explorer to retrieve the metadata for the selected tables and
update the diagram

Back to Top

5.3 Relationship Routing and Rerouting

Relationship connections may be manually rerouted by selecting the target relationship and then dragging bend-points
on the connection. When a relationship is selected, the diagram changes as follows:

• The relationship line color changes to red


• The relationship tables are background color changes to the selected color
• Bend-points (small black knobs) are displayed.

Figure 8 depicts a selected relationship that has been manually routed.

Figure 8. Selected relationship showing its bend-points

A relationship that has been manually routed can be automatically rerouted using the MyEclipse Layout Engine. This
feature is useful when manually routing produces undesirable results and the user wishes to return to auto-layout of a
relationship. To do so, select the relationship that has been manually rerouted. Then from the context-menu (right-click
menu) select the Reroute action (see Figure 8). The Layout Engine will reroute the relationship using its optimization
algorithm.

Table 9. Invoking relationship reroute action


Figure 10. Relationship following rerouting action

Back to Top

5.4 Visual Grid, Table Alignment , and Table Resizing

The ER-Designer provides a visual grid and grid alignment and table sizing tools to help you manually layout tables
and relationship routing in a uniform and aesthetically pleasing style.

Grid - To toggle the visual Grid feature on/off do the following:

1. Select the ER-Designer for HR.mer


2. From the menubar select View > Grid

Figure 11. Toggling the visual grid on and off

Snap To Grid - The Snap To Grid feature facilitates the manual alignment of tables and relationships by constraining
their placement to align with vertical and horizontal grid lines. The Grid is NOT required to be visible for this feature to
be activated. To toggle the Snap to Grid feature on/off do the following:

1. Select the ER-Designer for HR.mer


2. From the menubar select View > Snap To Grid
Figure 12. Toggling the Snap to grid on and off

Horizontal and Vertical Alignment Tools - The ER-Design contributes table alignment tools to the MyEclipse toolbar.
To align 1 or more tables do the following:

1. Select 2 or tables that you wish to align


2. From the MyEclipse toolbar select the alignment style to apply to the selected tables. The toolbar alignment
styles are shown in Figure X.

Figure 13. Toolbar table alignment styles

Table Resizing Tools - The ER-Designer contributes table resizing tools to the MyEclipse toolbar. To resize 1 or more
tables do the following:

1. Select 2 or tables that you wish to resize


2. From the MyEclipse toolbar select the resizing style to apply to the selected tables. The toolbar resize styles
are shown in Figure X.

Figure 14. Toolbar table resize styles

Back to Top

5.5 Locating and Selecting Tables


Browsing a large ER diagram to locate 1 or more tables can be tedious. To simplify this process the ER-Designer
provides 2 table location features. The first is an Outline View that depicts the database tables in tree list. The second
is a Table Section Dialog that provides fast table name search and location. Once you have located the tables of
interest you may select and manipulate them.

To view and select a table from the outline view do the following:

1. If the Outline View is not already opened, then from the menubar select Window > Show View > Basic >
Outline
2. Scroll the Outline View to the desired table and select it. This will cause the corresponding ER-Diagram table to
be highlighted and scrolled into view.

For example Figure 15 shows the JOB_HISTORY table selected in the outline view and the corresponding ER digram
table symbol highlighted and visible.

Figure 15. Locating a table in the Outline View


Table Locator Dialog

In addition to using the Outline View to locate your tables of interest, the ER-Designer provides the Table Locator, a
pop-up dialog with a fast text search feature.The Table Locator is launched by from either the ER-Designer's context-
menu, the Navigate menubar, or the Outline toolbar. This example will use the Outline toolbar action to launch the
Table Locator.

1. From the Outline toolbar select the search icon (see Figure X)

Figure 16. Launching Table Locator from Outline View

2. The Table Locator Dialog will appear (see Figure 17)


Figure 17. Table Locator Dialog

3. If your table is not in view of the dialog type in the first few characters of its name and the list will quickly filter to
the set table names that have a prefix of the string that you entered
4. Select your table of interest
5. Select OK to complete the search process

The Table Locator Dialog will close and the ER-Designer will scroll the selected table into view and highlight it in a
manner similar to the Outline View location.

Back to Top

6. Exporting a Diagram
The ER-Designer enables you to export ERDs in the JPEG image format. To export an ERD, from the context-menu
select the Export As JPEG... action. This will open a file selection dialog for you to specify the location of the new
JPEG image. The export action can be seen in the context-menu of Figure 18.

Note: A large ERD can easily require 100's of megabytes to represent it in image format. In some cases this may
result in failure of the export operation as the image is too large to manage in version 3.8.3. A future version of the ER-
Design will optimize the image export memory requirements.
Figure 18. Export As JPEG image action

Back to Top

7. Configuring the ER-Designer


You may customize the look and feel of the ER-Designer through its MyEclipse preference page. To access the ER-
Designer preference page, select from the menubar Window > Preferences > MyEclipse > Database Explorer > ER-
Designer.
Figure 19. ER-Designer Preference page

8. Summary
This concludes the introduction to the MyEclipse ER-Designer features and their use. Additional Quickstart documents
are available that introduce working with Hibernate along with the Database Explorer, as well as working Web Projects,
editing HTML, application server configuration, and enterprise application projects. For more information visit the
MyEclipse Application Developer Help topic.

Back to Top

9. User Feedback
If you have comments or suggestions regarding this document please submit them to the MyEclipse Documentation
Forum .

Back to Top
10. References
• Introduction to Data Modeling
• Download Java 2 SDK, Standard Edition 1.4 from Sun Microsystems.
• Download Eclipse 3.1 SDK or greater from the Eclipse Foundation
• Download the MyEclipse 4.0 30 day trial edition; portal registration is required.
• Visit the MyEclipse Quickstart Library for more MyEclipse tutorials.

Back to Top

Copyright © 2004 - 2005 by Genuitec L.L.C