Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

share|improve this question
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… – 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
up vote 1 down vote accepted


  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!


share|improve this answer
"3. Folow this guide"... Seems that would have an link, but there's none... – Fabricio Araujo Oct 11 '11 at 19:41
Hmm, not sure what happened to the link. Anyways, here it is:…. Also of note, ObjectAID is apparently better than JPA; so try it out! – A T Oct 12 '11 at 4:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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