Yes it is possible. What you are asking for is a " table for hierarchy " inheritance. Your table should contain any “discriminator column” that identifies the type of each row.
However, no record for one person can have more than one particular type during materialization (counting from the database), since an object can have only one type. I wrote about this problem before :
One of the mental barriers that you must overcome when designing a good relational mapping of objects is the tendency to think primarily in object-oriented terms or relational terms, depending on your personality. A good relational mapping of objects, however, includes both a good object model and a good relational model. For example, let's say you have a database with a table for people and related tables for employees and customers. One person can have an entry in all three tables. Now, based on a strictly relational point of view, you can create a VIEW database for employees, and another for customers, which include information from the People table. When using one PICTURE or the other, you may temporarily think of an individual as “just” an Employee or “just” a Client, although you know that they are both. Thus, someone starting from this worldview may be tempted to do an OO mapping, where Employee and Customer are both (direct) subclasses of Person. But this does not work with the data that we have; since one person has both employee and customer records (and since the Person instance cannot have a specific subtype of Employee and Customer at the same time), the OO relationship between Person and Employee should be more compound than inheritance, and similarly for Person and Customer .
If "Bob" is Participant , which is both an artist and an author, then he cannot be of the type, say, Artist and Author at the same time, unless he is a supertype of another, Any author and author must have a subtype relationship with another , or you must use aggregation rather than inheritance to associate Participant with Artist and Author . An instance of an object can have only one specific type; this does not change because you store it in the database.
Craig stuntz
source share