Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw Database Schema based on JPA entities in IntelliJ

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

like image 864
digiarnie Avatar asked Jul 29 '11 00:07

digiarnie


People also ask

How do you create a database schema diagram?

To create a new database diagramIn Object Explorer, right-click the Database Diagrams folder or any diagram in that folder. Choose New Database Diagram on the shortcut menu. The Add Table dialog box appears. Select the required tables in the Tables list and click Add.

How do I generate entities from an existing database in IntelliJ?

Generate a database entityClick Code | Generate or press Alt+Insert . Select the entity that you want to generate and press Enter .


3 Answers

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

like image 111
jmojico Avatar answered Sep 22 '22 23:09

jmojico


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.

like image 35
Pakka Pakka Avatar answered Sep 26 '22 23:09

Pakka Pakka


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

like image 33
boly38 Avatar answered Sep 26 '22 23:09

boly38