The SAP NetWeaver Developer Studio provides a JPA diagram editor tool that allows you to create, edit, and display the application data model (entities and their relationships) in a graphical environment.
Using the JPA diagram editor is possible if you are developing your application components in Development Component (DC) projects. You can use only one JPA diagram per DC project, and you cannot visualize entities from different DC projects in one JPA diagram.
Example
The following JPA diagram represents the data model of employees participating in various projects, that is, two entities with a bidirectional many-to-many relationship:
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 vice versa.
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 have:
Created a DC project
More information: Creating Development Components
Note
If you have an existing data model stored in a local project, you can convert the local project to a DC project.
More information: Migrating Standard Projects into Development Components
Enabled the Java Persistence facet on that DC project
More information: Creating JPA Projects in the Developer Studio
(Optional) Created your JPA entities in that DC project
Opened the Java EE perspective in the SAP NetWeaver Developer Studio
Task |
Steps |
---|---|
Configuring the JPA diagram editor |
|
Opening the JPA diagram |
|
Creating new entities |
In the Entities list of the Palette, choose (Entity), then click the diagram area. The Developer Studio creates the new entity with a predefined name and a primary key. |
Importing existing entities (if any) within a DC project to the diagram |
|
Defining and removing relationships between entities |
|
Managing entities |
You can perform the following operations on a particular entity graphical model:
To perform the actions described above, follow the steps:
|
Refactoring entities and attribute types |
Caution
End of the caution. Using the JPA diagram editor, you can perform the following refactoring operations:
|
Viewing and editing entities' source code |
To view and edit the source code of a particular entity, double-click the title of the corresponding entity block on the diagram. The Developer Studio opens the entity class in the standard source code editor. When you apply changes to the source code, they are automatically synchronized with the diagram. |
Applying templates to entities |
The Developer Studio allows you to apply a predefined “template” (for example, a session bean CRUD facade) on entities within the diagram.
More information about templates: Generating Applications Based On Predefined Templates |
Opening the Miniature view or the JPA Details view |
|
Removing all entities from the diagram |
Note This operation removes the entities from the JPA diagram only, that is, they are not removed from the underlying application data model. End of the note.
|