I have a table-per-subclass inheritance hierarchy (base class table and a table for each subclass where each subclass table has a foreign key to the base class table). The hierarchy is: Device (base class) with Router, Switch, Hub, etc. as subclasses. I want to be able to write a query where the user can enter any of the type names (and they correspond exactly to the names of the subclasses) and the correct objects are returned.
e.g. (this is logically what I want -- I know that table-per-subclass does not have a discriminator field like table-per-class-hierarchy)
select from Device where TypeName in ('Router', 'Switch')
I was going to add a TypeName field to my base class table that gets filled in when the device is saved but I was wondering if there is a better way.
Thanks,
Bill
_________________ metazone
|