16

I'm writing a java code using ormlite. I was wondering if it's possible to generate an ERD from the JPA annotations in my code. Basically, I need the reverse of this: How can I transform Entity-Based diagram to a JPA java code

Community
  • 1
  • 1
Mohammad Moghimi
  • 4,636
  • 14
  • 50
  • 76
  • 1
    Can't you let JPA create the tables and then generate the ERD from the actual database? –  Apr 17 '12 at 08:34
  • 2
    That's a possibility. You mean something like this? http://stackoverflow.com/questions/2488/auto-generate-database-diagram-mysql right? But It'd be better if is possible to generate ERD directly from java codes. – Mohammad Moghimi Apr 17 '12 at 18:38

1 Answers1

16

IntelliJ IDEA (Ultimate) provides JPA to ER-Diagram generator.

context menu

In the Persistence tool window, select appropriate node. Then use context menu to select "ER Diagram".

sample ER diagram

Note that JPA facet must be linked to module and UML plugin should be active.

Hollis Waite
  • 1,079
  • 1
  • 20
  • 31