A Pattern of Inheritance and Polymorphism for Persistent Objects Stored in a Relational Database


By: C. Pang
Published in: JOOP, Feb. 1999
Pages: 41-44
Category: Database

Summary: Allow persistent objects whose data are stored in a relational database to retain inheritance and polymorphism features.

Pattern: Surrogate

Allow persistent objects whose data are stored in a relational database to retain inheritance and polymorphism features. Create a table for each class in the inheritance hierarchy. The tables will contain columns for each attribute defined in that class and an additional column representing the common key shared among all subclass tables. The base class has an attribute called subtype.