beautypg.com

Specifying referential integrity rules, Specifying referential integrity rules 72 – Apple WebObjects 3.5 User Manual

Page 72

background image

Chapter 3

Creating a WebObjects Database Application

72

1. Select

movieId

as the primary key for the Movie entity.

2. Click Next.

3. Select both

movieId

and

talentId

as the primary key for the MovieRole entity.

MovieRole’s primary key is compound; that is, it’s composed of more than
one attribute. Use a compound primary key when any single attribute isn’t
sufficient to uniquely identify a row. For MovieRole, the combination of
the

movieId

and

talentId

attributes is guaranteed to uniquely identify a row.

4. Click Next.

5. Select

talentId

as the primary key for the Talent entity.

6. Click Next.

Specifying Referential Integrity Rules

If you’re using a database that stores foreign key definitions in its database
server’s schema information, the wizard reads them and creates corresponding
relationships in your model. For example, Movie has a to-many relationship to
MovieRole (that is, a Movie has a vector of MovieRoles), and Talent has a
to-many relationship to MovieRole. The wizard now asks you to provide
additional information about the relationships so it can further configure them.

Shift-click to select more
than one attribute.