Examining the Variables
- Double-click Main.wo in Project Builder's WebObjects Components category to open the Main component in WebObjects Builder.
- In Project Builder, look at the class file Main.java to see how movie is declared.
- In Project Builder, examine movieDisplayGroup's declaration in Main.java.
There are four variables in the object browser: the application and session variables that are available in all components and two others, movie and movieDisplayGroup.
The movie variable is an enterprise object that represents a row fetched from the MOVIE table. movieDisplayGroup is a display group-an object that interacts with a database, indirectly through classes in the Enterprise Objects Framework. Display groups are used to fetch, insert, update, and delete enterprise objects that are associated with a single entity. movieDisplayGroup's entity is Movie, which you specified in the wizard's "Choose an entity" page.
The movie declaration (shown below) declares movie to be an EnterpriseObject-a Java interface that describes the general behavior that all enterprise objects must have.
/** @TypeInfo Movie */ protected EnterpriseObject movie;
At run time, movie is a GenericRecord object. Recall that GenericRecord is used to represent enterprise objects unless you specify a custom class. Since you didn't check the "Use custom enterprise objects" box in the wizard's "Choose what to include in your model" page, your application defaults to using GenericRecord for all its entities.
The comment (/** @TypeInfo Movie */) is used by WebObjects Builder to identify movie's entity (Movie). Knowing the entity allows WebObjects Builder to display movie's attributes (category, dateReleased, and so on). You can see movie's attributes if you select the movie variable in the WebObjects Builder's object browser.
The declaration (shown below) declares movieDisplayGroup to be a DisplayGroup.
protected DisplayGroup movieDisplayGroup;
Also note the comment explaining how movieDisplayGroup is initialized. The Main.java class doesn't have any code to create and initialize the display group. Instead, it's instantiated from an archive file, Main.woo, that's stored in the Main.wo component. You shouldn't edit woo files by hand; they're maintained by WebObjects Builder. The woo file archiving mechanism is described in more detail later in "Specifying a Sort Order".
Table of Contents Next Section