Is there a way to generate a UML class diagram fro

2019-04-02 12:10发布

问题:

Was just wondering if there was any software out there to do this? The storage engine is InnoDB so the foreign keys are in place to connect the tables up in the diagram (if such software even exists).

回答1:

You can generate a data model from the data table that shows foreign key constraints using Enterprise Architect.

That gives you a data model in a UML tool that you can easily trace to other UML artifacts. It does not auto-create a class model from the data tables however. It is not best practice to have your class model directly mirror your data model, but this would give you a good head start.



回答2:

Heres the way I did it using Visual Paradigm for UML.

What you will need:

- Visual Paradigm for UML

- JDBC MySQL Connector: http://dev.mysql.com/downloads/mirror.php?id=383235#mirrors

1) Install Visual Paradigm for UML.

2) Download and extract the JDBC MySQL Connector.

3) Open VIsual Paradigm for UML.

4) Select Tools --> Instant Reverse --> JDBC

5) Select JDBC from the Language drop down box.

6) Click the '...' button and browse to your extracted JDBC MySQL connector folder, and select the 'mysql-connector-java' .jar file.

7) Select 'MySQL' from the JDBC driver name drop down box.

8) In the 'JDBC Connection URL' text box, type jdbc:mysql://~yoururl~/~yourdatabase~

9) Enter MySQL Database username and password and click 'ok'.

10) Select the options you want from the new dialogue box and your done!



回答3:

Another way to do is to create a java code from the database using a project such as Dali. Once you have created the database with annotations in the code (e.g. entity for example) you can reverse it into a class diagram. You therefore get a UML model from database. The final stage is to remodel and generate again the database with hibernate for example. This is possible because the use of Java annotation mixed with the UML model. Really cool :-)

I know that Omondo is providing java annotation UML support and think some other tools should have the same feature but don't know which one.