Using IntelliJ Persistence View and ER Diagram Mapping Tools

IntelliJ IDEA has the tools to help you create and manage Entities and Entity Relationships with little coding. This post serves as a screenshot tour of the IntelliJ Persistence View and ER Diagram Mapping Tools to help you get started.

Before you can use the Persistence View and Mapping Tools you have to add Java EE Persistence Framework Support to your project or module. Here we’re adding the Persistence Tools to our “hibernate” module, part of my Spring-Data app on GitHub.

The first dialog box that appears gives us the ability to generate objects for existing models and create Entity Models from a database schema.

We’re going to generate persistence objects for existing models in the hibernate module. I’ll demonstrate importing from a database in a follow-up post. Below are our existing module models displayed in the Persistence View. “Module models, module models, module models…”

Whenever you want to create objects from a database, getting started is as easy as right-click and “Generate Persistence Mapping.”

Of course the real fun in the Persistence Mapping Tools is using the Entity Relationship Mapper. Right-click and select “ER Diagram” for the magic to happen.

Who doesn’t like drag and drop and popup dialog boxes that generate code? Here’s a layout of our simple Entity Map.

Entities are all about their relationships with one another so there is support for editing and creating relationships here as well. Double-click on any link arrow to edit a relationship.

Or create something else by right-clicking on the entity.

Mastering the Entity Relationship Mapper is the secret to being productive working with Entities. In my next post we’re going to look more at creating relationships with the Persistence View and see what code we’re generating in our Entity Models.