How to Generate Class Diagram from ERD?
Visual Paradigm supports generating class diagrams from ER diagrams (entity relationship diagram). Entities and relationships are mapped with classes and associations accordingly. This tutorial teaches generating class diagrams from entity relationships diagrams and how to synchronize description between classes and entities.
To generate class diagrams from entity relationship diagrams:
- First, open the Project Browser by selecting View > Project Browser from the toolbar.

- Click the New Model button to create a new model.

- Enter the name as "Entity Model."

- Now, let's create an entity relationship diagram under Entity Model. Right-click on the Entity Model and select Sub Diagrams > New Diagram....

- In the New Diagram popup window, select Database Modeling > Entity Relationship Diagram. Click OK to confirm.

- Develop the following entity relationship diagram.

- Repeat the above steps to create the following entity relationship diagram under Entity Model.

- Once the entity relationship diagrams are ready, we can then generate class diagrams from our entity relationship model. Select Tools > Hibernate > Synchronize to Class Diagram from the toolbar.

- The Synchronize from Entity Relationship Diagram to Class Diagram dialog will be shown. The entity relationship diagrams in your project are shown on the left-hand side of the table, and the target class diagram is shown on the right-hand side.

- Click on the entity relationship diagram cell, and the preview will be shown.

- You can name the target class diagram directly in the class diagram cell, or you can synchronize to an existing class diagram (if any).

- Press OK to proceed.
- Now the Synchronize to Class Diagram dialog will show up. The mapping between entity name and class name, as well as the column name and attribute name, will be listed in the dialog. Let's change the name of the User class to Customer and change the attribute name from firstname to firstName.

- We can specify the target for storing the output class diagram. Select Specify... in the Target Parent combo box.

- Select the root node in the tree and press the New Model button. Name the model Class Model.

- Press OK to proceed.
- Now the class diagrams are being generated.

- Let's try to modify the description of the class PriorityType.

- You can synchronize the description from the class model to the associated entity model by right-clicking on the diagram and selecting Utilities > Synchronize Class Description to ERD.

- The Class Description to ERD dialog will list class models that contain different descriptions from the entity model.
- Click on the entity PriorityType in the list, and the differences in descriptions between the class and entity model will be shown.

- Select the checkbox under the Synchronize column to specify the model you would like to synchronize their descriptions.

- By selecting the Synchronize members checkbox, the descriptions of the class attribute and entity column will also be synchronized.

- Uncheck the Hide equals checkbox, and all classes/entities will be listed, even if their descriptions are the same.