Creating a Model
If you decide to create a model for your application, the wizard steps you through a succession of windows. The model file, when created, is given the name of your project, in this case StudioManager.eomodeld.-
Choose an adaptor for your database server.
Select an adaptor for the database you want to use.
-
Log into your chosen database server.
Log into the database, filling in any required information.
-
Choose options for the creation of your model.
Make sure every option is checked except "Use Custom Enterprise objects".
Assign primary keys to all entities
Enterprise Objects Framework uses primary keys as unique identifiers of enterprise objects with which it maps these objects 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 later on to prompt you to choose primary keys if they aren't defined in the database's schema information.Ask about relationships
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 might not provide enough information for the wizard to set all of a relationship's options. Checking this box causes the wizard to prompt you later to provide the additional information it needs to complete the relationship configurations.Ask about stored procedures
Checking this box causes the wizard to read stored procedures from the database's schema information, display them, and allow you to choose which to include in your model.Use custom enterprise objects
An entity maps a table to enterprise objects by storing the name of a database table (MOVIE, for example) and the name of the corresponding enterprise object class (a Java class such as Movie). When deciding what class to associate with an entity, you have two choices: EOGenericRecord or a custom class. EOGenericRecord is a class whose instances store as key-value pairs an entity's properties and the data associated with each property. They do nothing else. If you don't check the "Use custom enterprise objects" box, the wizard maps all your database tables to EOGenericRecord. If you do check this box, the wizard maps all your database tables to custom classes. The wizard assumes that each entity is to be represented by a custom class with the same name. For example, a table named MOVIE has an entity named Movie, whose corresponding custom class is also named Movie. Use a custom enterprise object class only when you need to add business logic; otherwise use EOGenericRecord. Note that this option, if selected, only assigns a class name; it does not create a class. The class of an entity remains EOGenericRecord, even if EOModeler shows a different class name, until you create the "skeletal" class file and add this file to the project. You'll perform this step later using EOModeler. -
Select the database tables to include your model.
Select the following tables: DIRECTOR, MOVIE, MOVIE_ROLE, PLOT_SUMMARY, REVIEW, STUDIO, TALENT, TALENT_PHOTO, and VOTING.
-
Specify the primary keys for your entities.
The entity... Should have the primary key attributes... -
Specify referential integrity rules for the relationships in the model.
Select the Nullify button in each "referential integrity" window that appears.
<Source object> owns its <destination> objects
This option specifies that a destination object in a relationship can't exist without its source object; the source object is said to "own" the destination object or objects in the relationship. For example, consider the case of Movie's to-many relationship to MovieRoles, which it owns. When a MovieRole is removed from its Movie's array of MovieRoles, the MovieRole is deleted--deleted in memory and deleted in the database.When <source object> is deleted
This set of options specifies what to do when the source object in a relationship is deleted.-
Nullify. Specifies that when the source object is deleted, any reciprocal relationship that the destination object has with the source object is set to null.
-
Cascade. Specifies that when a source object is deleted, the source's destination objects should also be deleted--again, deleted in memory and correspondingly in the database.
-
Deny. Specifies that if the relationship's source (for instance, a Talent) has any destination objects (MovieRoles), then the source object can't be deleted.
-
Select the stored procedures you want to include in your model.
This panel lists the stored procedures defined in your database, with all procedures selected by default.
-
Nullify. Specifies that when the source object is deleted, any reciprocal relationship that the destination object has with the source object is set to null.
© 1999 Apple Computer, Inc. (Last Updated 13 Sep 99)