Before you can use MovieRole and Talent objects in your application, you first need to go back to EOModeler and add relationships to the model's entities.
Relational databases model not just individual entities, but entities' relationships to one another. For example, a movie has zero, one, or more roles. This is modeled in the database by both the MOVIE table and MOVIE_ROLE table having a MOVIE_ID column. In the MOVIE_ROLE table, MOVIE_ID is a foreign key, while in MOVIE it's a primary key. A foreign key correlates with the primary key of another table to model a relationship a source table (MOVIE) has to a destination table (MOVIE_ROLE). In the following diagram, notice that the value in the MOVIE_ID column for both MOVIE_ROLE rows is 501. This matches the value in the MOVIE_ID column of the "Alien" MOVIE row. In other words, "Ripley" and "Ash" are both roles in the movie "Alien."
Suppose you fetch a Movie object. Enterprise Objects Framework takes the value for the movie's MOVIE_ID attribute and looks up movie roles with the corresponding MOVIE_ID foreign key. The framework then assembles an object graph that connects the Movie object with its MovieRoles. As shown below, a Movie object has an array of its MovieRoles, and the MovieRoles each have a Movie.
After you add relationships to your model, you can access MovieRole and Talent objects through the Movie objects fetched by the movies display group. Using WebObjects Builder, you'll bind attributes of MovieRole and Talent objects to elements in the Movie Details page.
A new relationship named "Relationship" is added in the table view at the bottom of the model file window.
The Relationship Inspector opens.
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."
A to-one relationship in the MovieRole entity where:
A to-one relationship in the MovieRole entity where:
A to-many relationship in the Talent entity where:
A Consistency Check panel runs alerting you that several of the model's entities don't have primary keys.
You'll add primary key values in the next step.
The Movies application only uses the Movie, MovieRole, and Talent entities, but you should assign primary keys to all the entities in case you extend the application later.
Note that some of the entities have compound primary keys; that is, a primary key that is composed of more than one attribute.
Now when you save, EOModeler should not display the Consistency Check panel.
The strings should all be on the same line, so don't type carriage returns between them.
Remember that a Movie object has a movieRoles instance variable that's an array of MovieRole objects. The steps above bind the movieRoles array of the selected Movie object to the repetition's list attribute. WebObjects Builder automatically adds a new variable to the MovieDetails component named movieRole and binds it to the repetition's item attribute.
The movieRole variable, a MovieRole object, has an instance variable-talent-that's a Talent object. (The talent instance variable is the result of the to-one relationship from the MovieRole entity to the Talent entity.) Through the movieRole instance variable, you can access the name of the actor playing a particular role.
You may need the assistance of your system administrator to end the running Movies process, but generally you use the Windows NT Task Manager to end processes.
The Task Manager window opens.
For Unix Users Only: On Unix systems you can use the kill command to end the WODefaultApp process.
Table of Contents Next Section