Jump to Menu

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.

Compatible edition(s): Enterprise, Professional, Standard

  • October 30, 2009
  • Views: 245,674
  • PDF

To generate class diagrams from entity relationship diagrams:

  1. We first open Project Browser by selecting View > Project Browser from the toolbar.
    open project browser
  2. Click the New Model button to create a new model.
    new model
  3. Enter the name as Entity Model.
    input eame in model specification
  4. Now, let's create entity relationship diagram under Entity Model. Right-click on the Entity Model and select Sub Diagrams > New Diagram....
    create diagram
  5. In the New Diagram popup window, select Database Modeling > Entity Relationship Diagram. Click Ok to confirm.
    create entity relationship diagram
  6. Develop the following entity relationship diagram.
    device support history er diagram
  7. Repeat the above steps to create the following entity relationship diagram under Entity Model.
    device puurchase er diagram
  8. 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.
    synchronize to class diagram
  9. The Synchronize form Entity Relationship Diagram to Class Diagram dialog will be shown. The entity relationship diagrams in your project show on the left hand side of the table and the target class diagram shows on the right hand side.
    er diagram to uml class diagram mapping dialog box
  10. Click on the entity relationship diagram cell and the preview will be shown up.
    preview erd diagram
  11. You can name the target class diagram directly in the class diagram cell or you can synchronize to existing class diagram (if any).
    assign meaningful name to uml class diagram
  12. Press OK to proceed.
  13. Now the Synchronize to Class Diagram dialog will show up. The mapping between entity name and class name, also 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.
    entity column to class attribute mapping table
  14. We can specify the target for storing the output class diagram. Select Specify... in the Target Parent combo box.
    selecting target model
  15. Select the root node in the tree and press the New Model button. Name the model as Class Model.
    create class model
  16. Press OK to proceed.
  17. Now the class diagrams are being generated.
    generated uml class diagrams
  18. Let's try to modify the description of the class PriorityType.
    modigy priority type class description
  19. You can synchronize the description from class model to the associated entity model by right click on the diagram and select Utilities > Synchronize Class Description to ERD.
    synchronize class documentation to ER diagram
  20. Class Description to ERD dialog will list class models which contain different descriptions with the entity model.
  21. Click on the entity PriorityType in the list and the differences of descriptions between class and entity model will be shown.
    synchronize class documentation dialog box
  22. Select the checkbox under Synchronize column to specify the model you would like to synchronize their descriptions.
    check synchronize classes and entities
  23. By selecting Synchronize members checkbox, the descriptions of the class attribute and entity column will also being synchronized.
    check synchronize member checkbox
  24. Uncheck the Hide equals checkbox and all the classes/entity will be listed, even their descriptions are the same.


创造美好 共同成长

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK