13

Does anyone know if there is a plugin available for IntelliJ that will draw the database schema diagram based on JPA entity classes?

3 Answers 3

9

IntelliJ (ultimate edition) can generate an ER diagram, without any additional plugins. It's available from the context menu in the "Persistence" pane.

To get that pane, you'll need to add a "JPA" facet to your module first.

2
  • how do you add the JPA facet to your module? I can't seem to find that.
    – digiarnie
    Commented Dec 13, 2011 at 23:12
  • 2
    In Project Structure (Ctrl-Shift-Alt-S), you'll see a list of modules. There's a "+" (plus) button above the module list. Clicking it will allow you to add various facets to existing modules. Examples are: Spring, GWT, Hibernate and JPA. Note that support for "enterprisey" frameworks (like JPA) is not part of the free IntelliJ "Community" edition. Commented Apr 13, 2012 at 8:33
7

pre-requisite to get "ER Diagram" entry in the context menu :

  • ultimate version (seems not be available into the "Community version")
  • JPA Facet onto the module
  • UML Plugin activated (files/other settings/configure plugins ; this plugin enables diagrams)
    • then Right clic onto the "persistenceUnit" into the "Persistence" tool windows

I just add this comment into the official documentation (comment awaiting moderation).

Official doc : http://www.jetbrains.com/idea/webhelp/opening-jpa-or-hibernate-er-diagram.html

7

File, Project Settings, click "+". Select the module which contains Java classes annotated with JPA. Then add JPA facet like this: enter image description here

Make sure you choose your framework correctly:

enter image description here

Then follow this steps:

enter image description here

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