Table of Contents Previous Section
Creating a New Model
To create a model, choose Model New.EOModeler starts the New Model Wizard, which assists you to configure your new model. The following sections describe the wizard pages that guide you through the model creation process.
Selecting an Adaptor
An adaptor is a mechanism that connects your application to a particular database server. For each type of server you use, you need a separate adaptor. Enterprise Objects Framework provides adaptors for Informix, Oracle, and Sybase servers, and for any server that is ODBC compliant. It also provides a sample adaptor for a flat-file data store and an adaptor for OpenBase Lite-a database that ships with Enterprise Objects Framework as an unsupported demo.
Figure 2. Selecting an Adaptor
After you select an adaptor, EOModeler displays the login panel for the database that corresponds to the adaptor you selected. Fill in the login panel and click OK.
Figure 3. Oracle Login Panel
Different databases require different login information, so each database's login panel looks different.The examples in this chapter use the Oracle version of the Movies database included with the Enterprise Objects Framework; Figure 3 shows the Oracle login panel.
Figure 4. Choosing What to Include in the Model
Figure 5. Choosing the Tables to Include
Choosing What to Include in Your Model
In this next wizard page, you can specify the degree to which the wizard configures your model. Choosing the Tables to Include
After specifying what additional information to include in your model, the wizard prompts you to choose the tables to include in your model. By default, all the tables are selected.
Specifying Primary Keys
If you are using a database that stores primary key information in its database server's schema information, the wizard skips this step. The wizard has already successfully read primary key information from the schema information and assigned primary keys to your model.However, if primary key information isn't specified in your database server's schema information or if the adaptor can't read it (as with Microsoft Access), the wizard now asks you to specify a primary key for each entity.
Figure 6. Specifying an Entity's Primary Key
If an entity's primary key is compound; that is, if it's composed of more than one attribute, control-shift-click to select all of the attributes in the primary key. You use a compound primary key when any single attribute isn't sufficient to uniquely identify a row. For example, in the MovieRole entity, if requires the combination of the movieId and talentId attributes to uniquely identify a row.
Specifying Referential Integrity Rules
If foreign key definitions aren't specified in your database server's schema information or the adaptor can't read that information (as with Microsoft Access), the wizard hasn't created any relationships at all, and it skips this step. You can add relationships later as described in the chapter Working with Relationships.
On the other hand, 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 an array of MovieRoles), and Talent has a to-many relationship to MovieRole.
Figure 7. Specifying Referential Integrity Rules for a Relationship
Delete Rule
- Delete the Movie and set all it's MovieRoles not to be associated with a Movie (nullify).
- Delete the Movie and all its MovieRoles (cascade).
- Refuse the deletion if the Movie has MovieRoles (deny).
Choosing Stored Procedures
If you asked the wizard to include stored procedures in your model (as described in Choosing What to Include in Your Model), the wizard asks you to specify which stored procedures to include. By default, all the stored procedures are selected.
Figure 8. Choosing the Stored Procedures to Include
Saving the Model
When you finish the wizard, EOModeler displays the new model. If you're planning to use your model in an application for which you've already created a project, you should save the model into your project folder. You will be prompted to add it to the project; click OK.
Table of Contents Next Section