Creating object relational mapping diagram

When you need to develop applications that involve storing data in database, you need to take care of the communication between the application and the database. Some people prefer to communicate with database through JDBC, while some prefer object relational mapping (ORM). ORM diagram can be used to show the mapping between the ORM-Persistable class and its corresponding entity (table). With ORM diagram, mappings between classes and entities, and between attributes and columns can be clearly identified.

Creating object relational mapping diagram

To create an object relational mapping diagram right click on ORM Diagram in Diagram Navigator and select New ORM Diagram from the pop-up menu.

Create an ORM diagram through Diagram Navigator
Create an ORM diagram through Diagram Navigator

Creating ORM-Persistable class and adding attributes

To create an entity, select ORM-Persistable Class in diagram toolbar and click on diagram. To add an attribute in class, right click on the class and select New Attribute from the popup menu.

To create an attribute in class
To create an attribute in class

Creating entity and adding columns

To create an entity, select Entity in diagram toolbar and click on diagram. To add a column in entity, right click on the entity and select New Column from the popup menu.

To create column in entity
To create column in entity

Mapping class and entity

To map between a class and an entity:

  1. Move the mouse pointer over the class (or the entity). Press on the resource icon Class-Entity Mapping -> Entity (Class-Entity Mapping -> Class for entity).
    To map from class to entity
    To map from class to entity
  2. Drag to the entity to map and release the mouse button. A connector will be created between the class and entity, indicating a mapping relationship.
    Class and entity is mapped
    Class and entity is mapped
NOTE: One class can be mapped with at most one entity. Once a mapping exist, you will not see the resource icon for creating mapping anymore.

Synchronizing from classes to entities

When you have made change on a class say to add attributes or to rename class, you can synchronize the change from class to entity. To do this, right click on the background of diagram and select Synchronize from Classes to Entities from the popup menu.

To synchronize changes from class to entity
To synchronize changes from class to entity
Columns are created in entity resulted by synchronization
Columns are created in entity resulted by synchronization

Changing the view of mapping

Instead of viewing the mapping in class and entity level, you can view the mapping in attribute and column level, too. To change the view, right click on the background of diagram and select Presentation Options > Mapping View, then Class Mapping or Attribute Mapping from the popup menu.

Attribute mapping is applied
Attribute mapping is applied
 
Chapter 2. Object relational mapping diagram Table of Contents Part VIII. Requirement modeling
 

Technical Support

Have technical issues or suggestions? Please contact Visual Paradigm Support Team.

Sales Support

Have questions related to registration, licensing or payment? Feel free to contact Visual Paradigm Sales Team.

Discussion Forum

Share your suggestions of opinions at VP Discussion Forum.