Eclipse JPA Editor tutorial

User Rating: 2 / 5

Star ActiveStar ActiveStar InactiveStar InactiveStar Inactive
 

The JPA Diagram Editor is a graphical tool based on the Graphiti framework that enables the JPA developers to create, view, and edit their business data model as graphical diagram.

JPA Diagram Editor is compatible with Indigo and later releases of the eclipse. (Including Helios and Juno).
From the JPA specification point of view, JPA diagram editor offers full support for JPA 1.0. JPA 2.0 support development is in progress as well as support of additional JPA artifacts like embeddable classes and mapped superclasses.

The simplest way to use this plugin, is to enter Eclipse MarketPlace and look for it (Hint enter JPA in the Find box and choose to install the JPA Diagram Editor):
eclipse jpa editor tutorial

Features:

  • The JPA diagram editor comprises the following general features:
  • Ability to create entities and define relationships between them.
  • Ability to import existing entities together with their relationships.
  • Full synchronization with the underlying application code, that is, whenever you apply a change to any of the objects on the diagram, the corresponding application code updates automatically, and the opposite.
  • Error and warning markers with informative quick info text. You can view details on the marked errors and warnings in the Problems view.
  • Integration with the JPA Details view and the Miniature View.

Prerequisites:

You need to have:

  • Created a JPA project to store your entities
  • You have a Non-JPA project but you enabled the Java Persistence facet on that project

How to open the JPA Diagram:

The Open Diagram action is available on project level: Select the newly created JPA project and from its context menu select JPA Tools -> Open Diagram

jpa_editor4

  Trick: You can open the JPA diagram also at JPA node level: Expand the   JPA project and from the context menu of its JPA node, select Open Diagram.

How to create a new Entity using the JPA Palette:

From the right site of the editor, the so called Palette section, select Java Entity and drag&drop it to the diagram. A new entity class org.persistence.Entity1 with default primary key attribute should be created and shown in the diagram. By right-clicking on the icon, you can rename it and add attributes to your Entity.

eclipse jpa editor diagram plugin

  You can change the default settings for your Entities by entering the Project Properties | JPA Section. There you can define the default package for your Entities, the Collection used by default for Relationship and lots of other settings.

How to see the Entities you have already created in the diagram:

If you want to visualize existing Entities in the diagram, simply open the JPA Diagram and drag and drop the Entities from the project into the Diagram.

jpa diagram editor tutorial eclipse

 Hot Trick: How to show all the existing Entities you have in one shot ? simply right click on your JPA Diagram and select "Show all Entities"