Table of Contents Previous Section
Changes to EOModeler
EOModeler in release 3.0 has the following changes:
- Improvements in the way you create a model file and database from scratch
- Support for prototype attributes, which you can use to quickly set up attributes
- The ability to create and store complex queries (or EOFetchSpecifications)
- A different bundle loading procedure
Improved Database Creation Support
The most common way to create a model file is to use information stored in an already-created database. Sometimes, however, it's useful to create the model file first and use that model to create the empty database and generate the database tables. In release 3.0, EOModeler contains improvements that make it easier to create and delete the database:
- The adaptor login panels now allow you to create a new database or user.
- The SQL Generation panel now has options for creating a database and deleting a database.
- EOModeler now supports the definition of prototype attributes that you can use to quickly set up attributes in the new model (see the section "Prototype Attributes").
- Choose New from the Model menu.
- Select an adaptor.
- Enter connection information for the new database (user name, password, and so on).
- Click Create.
- Provide the administrator connection information.
- Click Finish.
- Define the entities and attributes that you want the model to represent.
- Choose Generate SQL from the Property menu.
- Select the Create Tables option.
- Click the Execute SQL button.
Once the database is created, users will log into the database with this information.
The information you provide in this panel will be used to log into the database server to create the new database. The login information you provide must be for an account that has database creation permissions.
API for Database Creation and Deletion
This section describes new API that supports the database creation feature in EOModeler.
Prototype Attributes
To allow easier model creation from scratch, EOModeler now supports the concept of prototype attributes. Prototype attributes are just what they sound like - special EOAttributes from which other EOAttributes derive their settings. A prototype can specify any of the characteristics you normally define for an attribute. When you create an attribute, you can associate it with one of these prototypes, and the attribute's characteristics are then set from the prototype definition.
- An EOEntity named EO<adaptor-name>Prototypes, where <adaptor-name> is the name of the adaptor for your model (EOOraclePrototypes, for example)
- An EOEntity named EOPrototypes
- The adaptor for your model
When resolving a prototype name, Enterprise Objects Framework looks for prototypes in EO<adaptor-name>Prototypes, then in EOPrototypes, and finally in the adaptor for your model. This search path allows you to override the prototypes provided by each adaptor. Furthermore, if you don't want to use the adaptor-defined prototypes at all, you can hide them. Create an entity named EOPrototypesToHide. For each prototype you want to hide, create an attribute with that name; you don't need to specify other attribute properties.
API for Prototype Attributes
The following tables describe the API that has been added to support prototype attributes.EOAdaptor | |
---|---|
prototypeAttributes | Returns an array of prototype attributes specific to the adaptor. |
Query Builder
You can now use EOModeler to create a query, name it, and store it in the model file. To perform a query in Enterprise Objects Framework, you create an EOFetchSpecification object, which has associated with it an entity, a qualifier, a sort ordering for the fetched objects, and several other options. In previous releases, creating a fetch specification was usually done programmatically and could be quite complex and error prone. EOModeler now has a user interface that allows you to create the fetch specification, associate it with an entity, build the qualifier graphically, and specify the sort ordering and any other options, and test the complete fetch specification by dragging it into the Data Browser. API for Query Builder
This section describes API that has been added to support storing an EOFetchSpecification in the EOModel.
- A new class, EOQualifierVariable, defines objects that serve as placeholders in the qualifier. When you create a qualifier programmatically, you typically do something like this:
In Objective-C
aQual = [EOQualifier
qualifierWithQualifierFormat:"dateReleased = %@", aDate];
In Java
aQual = EOQualifier.qualifierWithQualifierFormat(
"dateReleased = %@", aDate);
where aDate is a variable that contains the actual date you want to query upon. When you store the qualifier in an EOModel, there is no way to know the actual value to query upon or the variable that will contain that value. The EOQualifierVariable object acts as a placeholder for the actual variable that will represent the right side of the expression. You specify an EOQualifierVariable by using a $, as in the following:
dateReleased = $aDate
For more information, see the section "Binding to Complex Qualifiers."
EOModelGroup | |
---|---|
fetchSpecificationNamed:entityNamed: (Objective-C) fetchSpecificationNamed (Java) | Returns the fetch specification identified by the provided name from the specified entity. |
EOModeler Bundle Loading
EOModeler's Preferences panel now allows you to specify file system locations in which to look for EOModeler bundles. EOModeler loads all the .EOMbundle files it finds in those locations. In the past, you specified the bundles you wanted to load with a user default. This same default still exists (and is used by the Preferences panel), but its value has a slightly different meaning. Whereas you used to specify the full path to each bundle to load, you now specify paths in which to search for bundles.
Table of Contents Next Section