ObjectExtender User's Guide and Reference


Creating persistence support

Before proceeding further with the example we will create some persistence support. This will enable us to illustrate the features of the home collection class, the support for transactions within ObjectExtender, and to start building views. Good object-oriented applications should be separated into layers and the persistence layer has the knowledge to store our business objects ( that is, make them persistent ) as well as do lookups for us against the store.

The persistence support classes we will generate will enable us to store objects locally within our image. This helps to iterate over the model schema and the model classes and to build working views to get the application as far along as possible without having to think about the issues associated with mapping the business objects to a relational data store.

To generate the persistence support that will enable us to do local image persistence, do the following:

  1. From the Model Browser, select TstUniversity, in the Models view.
  2. Select Generate Image Schema from the Models menu.

The persistent support classes are generated into the application, TstUniversityServicesApp.

The following classes will be generated:

TstUniversityDataStore
The data store owns and manages a pool of data store connections (sessions) and registers a home collection for each data store connection.

TstUniversityTstDepartmentDataObject
The data object class contains the data for a business object in the form in which it was retrieved from the persistent store.

The data objects that support the businesss objects will be stored in the image, and saved when the image is saved. To clear out these objects, and start from an empty set of objects, evaluate the following code:

        ImageServiceObject reset.
 
 

TstUniversityTstDepartmentServiceObject
The service object implements the Create/Read/Update/Delete (CRUD) protocol and other navigation methods required when mapping data objects to and from the persistent store.

Before working with objects in the model, the data store must be activated. To continue, evaluate the following code:

        TstUniversityDataStore singleton activate.
 
 

Because we generated the schema for local image persistence, the superclass of TstUniversityDataStore is LocalImageDataStore which will use the image as the mechanism for persistence.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]