Object-Relational Mappings: Editing JPA Entities
This document describes the following:
OEPE provides graphical interfaces for viewing entity relationship within a JPA project.
Using the Entity Diagram Editor, you can view and modify relationships between entities, get easy access to the entity source code, and create additional object-relational mappings. Note that the editor lets you edit properties of both entities and their fields. You can also edit the
To open the editor, right-click your project in the Project Explorer and select JPA > Show in Entity Editor from the drop-down menu, as Figure 1 shows. This will open the graphical entity editor shown in Figure 2.
Alternatively, you can open the editor from your project's JPA Content > persistence.xml folder by expanding the persistence unit and selecting a specific entity. In this case, the entity from which you launched the editor, will appear selected in the diagram.
The entity editor allows you to do the following:
To view entity properties in JPA Details view, select an entity in the editor by clicking on the entity name, as Figure 3 shows.
By right-clicking the entity name in the editor and making an appropriate selection from the drop-down menu shown in Figure 3, you can view the following:
Using the JPA Details view, you can change the following entity properties:
The changes that you make in the JPA Details view are reflected in the entity's source code. The example in Figure 4 shows the source code of an unchanged
Figure 5 and Figure 6 show the modified
The JPA Details view allows you to modify entity field properties. To do so, select a field in the editor, and then make changes in the JPA Details view, as Figure 7 shows.
Once again, the changes are reflected in the source code of this particular entity (
For more information on various types of properties that you can modify for each entity, field, and mapping, see the following:
OEPE Entity Diagram Editor lets you hide relationships in order to reduce the number of relationship lines displayed in the editor. This can be useful when you have a complex set of relationships between many entities. To hide specific relationships, use one of the following options:
If you compare the entity editor diagrams shown in Figure 3 and Figure 9, you will notice that Figure 9 displays the entity editor with one-to-many relationships hidden from view.
For more information on mapping relationships, see the following:
You can create new entity mappings by either clicking the icons on the editor menu (shown in Figure 10), or right-clicking on the editor display area and selecting either Add Entity from Database Table or Add Entity from Java Class from the drop-down menu.
Clicking the icons or selecting the options from the menu will launch OEPE wizards that generate entity mappings. For more information on using the wizards, see the following:
Once new entities are added, the entity editor will be refreshed and you will be able to see the new entities in the diagram.
In addition to viewing and editing entities, OEPE Entity Diagram Editor allows you to do the following: