2

How can I generate a class diagram from an SQL database or script? I'll add the functions and set whether the attributes are public, private or virtual once the initial diagram is generated.

I've generated it using PowerDesigner, here is the .sql file: http://pastebin.com/S14JWjKF

  • Have you already generated UML using PowerDesigner? Or used PowerDesigner to generate the SQL script? Not clear what you're asking Surely you can generate UML from PowerDesigner because your conceptial model is in PowerDesigner, not SQL. Like I'd use ORM dba.stackexchange.com/questions/1677/… – gbn Sep 29 '11 at 15:55
  • Looks like I can build an OO model straight from the ER Diagram in PowerDesigner. This one however, doesn't have the getter and setter operations. – A T Sep 29 '11 at 19:59
1

Solution:

  1. Generate SQL file in PowerDesigner (or any other tool capable of generating SQL, or write it by hand)
  2. Install Eclipse with JPA and Modelling Tools
  3. Follow this guide
  4. When the guide fails you (step 4), open up another tool (or you could probably do it in Eclipse with a new project), for instance, PowerDesigner; and reverse-engineer the Java code into a Class diagram
  5. Profit!

:D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.