Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Tools and Techniques

   

Adding Display Groups

A display group is an important type of variable that you use in WebObjects applications that access databases. A display group is an object that can fetch, insert, delete, display, update and search records in a database.

This section describes the mechanics of adding display groups to a WebObjects project. For detailed information about display groups, see the WODisplayGroup class specification in the WebObjects Class Reference. To learn more about how to create a WebObjects database application, see "Creating a WebObjects Database Application" in Getting Started With WebObjects.

WebObjects applications access databases through the Enterprise Objects Framework, which represents database rows as enterprise objects . Enterprise object classes typically correspond to database tables, and an enterprise object instance corresponds to a single row or record in a table. For detailed information on enterprise objects, read the Enterprise Objects Framework Tools and Techniques .

In a database application, you use entity-relationship models . A model associates database columns with instance variables of objects. You create a model with the EOModeler application, or you can specify one when you use the Wizard to set up your application (when you add a model to your project, it is added to the Resources suitcase). A model is stored in a model file . For more information on creating models, see the chapter "Using EOModeler" in Enterprise Objects Framework Developer's Guide .

A model contains entities, attributes, and relationships. An entity associates a database table with an enterprise object class. Display groups manage objects associated with a single entity. An attribute associates a database column with an instance variable. A relationship is a link between two entities that's based on attributes of the entities.

If you used the Wizard to set up your application, a display group was set up for you based on the model you specified. There are several other ways to create a display group:

When you use the Add Key panel, you can create not only display group variables, but also enterprise objects associated with any of the entities in your project's models.

In the figure, if you choose the entity Movie as the variable's type, the following code gets added to your source file:

/** @TypeInfo Movie */

protected EOEnterpriseObject selectedMovie;

The variable selectedMovie is declared as type EOEnterpriseObject. The comment /** @TypeInfo Movie */ is a structured comment that WebObjects Builder uses to identify the entity associated with the object (don't edit it). It is then able to display the attributes in the object browser as shown here:

Configuring the Display Group

Creating a Detail Display Group


© 1999 Apple Computer, Inc. – (Last Updated July 27 99)