Generate class diagrams from entity relationship diagrams

October 30, 2009
User Rating: / 0
Views: 945
PDF Add comments
Share |


Database Visual ARCHITECT (DB-VA) supports generates class diagrams from entity relationship diagrams. Every entities and relationships will map to classes and associations accordingly. This tutorial guide you how generate class diagrams from entity relationships diagrams and how to synchronize documentation between classes and entities.


To generate class diagrams from entity relationship diagrams:
  1. We first create Entity Model in Model Explorer. Right click on the Model Explorer and select Model > New Model.
    new model
  2. Enter the name as Entity Model.
    entity model
  3. Now let's create entity relationship diagram under Entity Model. Right click on the Entity Model and select Diagram > Database Modeling > Entity Relationship Diagram.
    new diagram
  4. Develop the following entity relationship diagram.
    erd1
  5. Repeat the above steps to create the following entity relationship diagram under Entity Model.
    erd2
  6. Once the entity relationship diagrams are ready, we can then generate class diagrams from our entity relationship model. Select Tools > Object-Relational Mapping (ORM) > Synchronize to Class Diagram.
    sync
  7. The Synchronize form Entity Relationship Diagram to Class Diagram dialog will be shown. The entity relationship diagrams in your project shows on the left hand side of the table, and the target class diagram shows on the right hand side.
    sync diagram dialog
  8. Click on the entity relationship diagram cell and the preview will be show up.
    preview
  9. You can name the target class diagram directly in the class diagram cell, or you can synchronize to existing class diagram (if any).
    rename diagram
  10. Press OK to proceed.
  11. 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.
    rename class attribute
  12. We can specify the target for storing the output class diagram. Select Specify... in the Target Parent combo box.
    specify location
  13. Select the root node in the tree and press the New Model button. Name the model as Class Model.
    target model
  14. Press OK to proceed.
  15. Now the class diagrams being generated.
    class diagram 1
  16. Let's try to modify the documentation of the class PriorityType.
    modify doc
  17. You can synchronize the documentation from class model to the associated entity model by right click on the diagram and select Utilities > Synchronize Class Documentation to ERD.
    sync doc
  18. Synchronize Class Documentation to ERD dialog will list class model which contain different documentation with the entity model.
  19. Click on the entity PriorityType in the list and the differences of documentation between class and entity model will be shown.
    diff
  20. Select the checkbox under Synchronize column to specify the model you would like to synchronize their documentation.
    select sync
  21. By select Synchronize members checbox, the documentation of the class attribute and entity column will also being synchronized.
    sync member
  22. Uncheck the Hide equals checkbox and all the classes/entity will be listed, even their documentation are same.
Comments (0)
Write comment

Name

Email

Title

Comment

Write the displayed characters

security code