ObjectExtender User's Guide and Reference

Defining the schema

In brief, use the Schema Browser to define a schema. The Schema Browser handles descriptions of tables, their columns, and key (primary and foreign) definitions.

Creating schemas. To create a schema:

  1. Launch the Schema Browser.
  2. From the Schemas menu, select New Schema.
  3. Name the schema.
  4. Click OK.

Creating tables and columns. To create a table for your schema:

  1. Select the schema name in the Schemas view.
  2. From the Tables menu, select New Table. This launches the Table Editor.
  3. Provide a logical table name. This is a logical name. It does not store in the database.
  4. Provide a physical table name. This name stores in the database.
  5. Create the columns for the table:
    1. In the Columns view, click New. This launches the Column Editor.
    2. Provide a column name. This is a logical name.
    3. Provide a physical column name. This name stores in the database.
    4. Choose a Type for the column.
    5. Under Type details, choose a Converter for the column. (Converters translate data. For example, a CHAR datum in a database converts to a Boolean object using the VapCharToBoolean converter).
    6. Click Allow nulls accordingly.
    7. In the Column Editor, click OK.

    Select a column(s) to be the Primary key and click the double arrow (>>).

  6. In the Table Editor, click OK.

Using Converters. A converter is used to change a class attribute type into another type before storing to the database. When reading from the database, the converter will change a particular database type into the correct class attribute type. For example, if you have a class attribute that has a Date type and the database column has a SQL type of DATE, no converter is needed. However, if you wanted to take this same class attribute and store it in a database column of SQL type VARCHAR, a converter is necessary because the class attribute of Date does not map directly to this SQL type.

The default converter used for fixed character columns is the VapTrimStringConverter. This converter truncates spaces from the end of the column value. If an object's identifier contains this column, object cache lookup is done with the truncated value, thus eliminating the chance of false cache hits or multiple cache entries. The drawback of this scenario is the key derived from a relating object will have a truncated value, and the resulting query will not find the appropriate rows in the database. Changing the converter to VapConverter will solve the later problem, but you must be aware of trailing spaces that become significant in object lookups.

Exporting schemas. Once your schema is defined, and saved, you will export the schema to the database. Note that the column name used for constraints uses the physical name.

You can wait to do this step until you are really ready to use the database. This is done as follows:

  1. From the Schemas menu, select the Import / Export Schema menu, then select Export Entire Schema to Database.
  2. Fill in the Database Connection Info dialog.
  3. Click OK.

Saving schemas. Save your schema definition to an application and storage class that you supply. Saving your schema enables you to take advantage of the existing library management functions. These functions are the same ones you use when sharing code with other developers such as versioning, releasing, and loading different editions of an application.

Suggestion: A useful naming convention is to name your application as follows: XYZMetadataApp where the XYZ is some prefix you choose. Use this application to store a model, schema, and map for a given application.

Recommendation: Save the schema definition to an application different from the generated model calsses.


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