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. In this article we will learn how to install it and use in your JPA projects.
JPA Diagrams at hand
JPA Diagram Editor is compatible with Indigo and later releases of the eclipse.
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: use “jpa editor” in the Find box and choose to install the JPA Diagram Editor):
- 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.
You need to have:
- A JPA project to store your entities
- A Non-JPA project but with the Java Persistence facet enabled 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
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.
How to see existing Entities 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.