I have a somewhat theoretical question. I have an abstract entity, Content, which has a large number of joined subtypes (Image, Story, Movie, etc). The primary key on the Content table appears in each sub types's table but each subtype has an additional synthetic key. As far as the database (oracle 8i) is concerned the synthetic key is the primary key on the sub type tables.
The tables are pretty big so here is the abridged versions:
Code:
CONTENT (ID number(12), .....);
IMAGES(CONTENT_ID number(12), --FK to CONTENT
ID number(12) PRIMARY KEY, -- comes from a sequence
....);
I have successfully mapped the subtypes using the primary key in the Content table joining it to the appropiate FK in the sub types. I have to manually ask Oracle for the correct sequence to safisy the PK constraint.
The difficulty comes in with components which hang off the sub types. They are keyed off the the (synthetic) sub type primary keys.
Code:
IMAGE_DETAILS(IMAGE_ID number(12), -- PK to IMAGES
....);
Does anyone have any good advice as to how to allow the inheritance and component behaviours with these keys?