

Adding Relationships to Your Model
The Movies application uses two pairs of inverse relationships. The first pair defines the relationship between the Movie and MovieRole entities, while the second pair defines the relationship between the MovieRole and Talent entities. An Enterprise Objects Framework relationship is directed; that is, a relationship has a source and a destination. Generally models define a relationship for each direction.- Select the Movie entity.
The right frame of the Model Editor shows the Movie's relationships as well as its attributes.
- Choose Property
Add Relationship.
A new relationship named "Relationship" is added in the table view at the bottom of the Model Editor. The new relationship is already selected.
- With the relationship selected in the right frame of the Model Editor, click the
button (in the toolbar) to inspect the relationship.
- In the Inspector, select the To Many option.
- Select MovieRole as the destination entity.
- Select movieId in the Source Attributes list.
- Select movieId in the Destination Attributes list.
- Click Connect.
EOModeler automatically renames the relationship based on the name of the destination entity. For example, after connecting a to-many relationship from Movie to MovieRole, EOModeler names the relationship "movieRoles." To-one relationships are named with the singular form of the destination entity's name. For example, EOModeler names the inverse to-one relationship (from MovieRole to Movie) "movie."
- Repeat the steps above to create the following relationships:
A to-one relationship named "movie" in the MovieRole entity where:
- The destination entity is Movie.
- The source attribute is movieId.
- The destination attribute is movieId.
A to-one relationship named "talent" in the MovieRole entity where:
- The destination entity is Talent.
- The source attribute is talentId.
- The destination attribute is talentId.
A to-many relationship named "movieRoles" in the Talent entity where:
- The destination entity is MovieRole.
- The source attribute is talentId.
- The destination attribute is talentId.
- Choose
in the toolbar pop-up list to switch the Model Editor to Diagram View.

You can also use the Diagram View to edit your model. Double-click an attribute or relationship to change its name. To create a relationship and its inverse, Control-drag from the relationship's source attribute to its destination attribute.
Table of Contents
Next Section