Specifics for Mapping Tables to Objects
Using existing relational data with objects at the application level requires mapping tables to objects. This figure illustrates such a mapping. Details for mapping tables to objects involve:
- Mapping relational data types into object types. In most cases this is straightforward mapping.
- Mapping relational table definitions to object classes. The table definitions map directly except for foreign keys. Those are replaced by relationships.
- Mapping inheritance based on a table or multiple tables. There may be type codes in a given table used to identify types of entities, such as types of clothing or types of employees. Those types can be turned into an inheritance structure at the object application level. Similarly, there may be separate tables for different types of entities. Again, this can be turned into an inheritance structure.
- Mapping tuple retrieval, keys and relational joins to relationships for object navigation. Object navigation replaces successive searches based on keys.
- Mapping "intersection tables" to object relationships. An example of an intersection table is the "Size Color" table used in the examples. This table exists because the relational model does not support many-to-many relationships. The relationship between "Size" and "Color Swatch" is a many-to-many relationship because a given size can have many color swatches and a color swatch can apply to many sizes.
More on the general topic: Mapping