beautypg.com

Apple WebObjects 3.5 User Manual

Page 69

background image

Designing the Main Page

69

A relationship is a link between two entities that’s based on attributes of the
entities. For example, the Movie entity has a relationship to the MovieRole
entity based on the entities’

movieId

attributes (although the attributes in this

example have the same name in both entities, they don’t have to). This
relationship makes it possible to find all of a Movie’s MovieRoles.

How complete the basic model is depends on how completely the schema
information is inside your database server. For example, the wizard includes
relationships in your model only if the server’s schema information specifies
foreign key definitions.

Using the options in this page, you can supplement the basic model with
additional information. (Note that the wizard doesn’t modify the
underlying database.)

1. Check the “Assign primary keys to all entities” box.

Enterprise Objects Framework uses primary keys to uniquely identify
enterprise objects and to map them to the appropriate database row.
Therefore, you must assign a primary key to each entity you use in
your application. The wizard automatically assigns primary keys to the
model if it finds primary key information in the database’s schema
information.

Checking this box causes the wizard to prompt you to choose primary
keys that aren’t defined in the database’s schema information. If your
database doesn’t define them, the wizard later prompts you to choose
primary keys.

2. Check the “Ask about relationships” box.

If there are foreign key definitions in the database’s schema
information, the wizard includes the corresponding relationships in the
basic model. However, a definition in the schema information doesn’t
provide enough information for the wizard to set all of a relationship’s
options. Checking this box causes the wizard to prompt you to provide
the additional information it needs to complete the relationship
configurations.