[odb-users] Derivation and empty classes

Boris Kolpackov boris at codesynthesis.com
Tue Dec 11 09:41:08 EST 2012

Hi Davide,

Davide Anastasia <Davide.Anastasia at qualitycapital.com> writes:

> I am trying to create a class hierarchy to be mapped into ODB objects
> using polymorphic derivation. However, many of my derived classes
> (pretty much all, except 2) are empty. Is there a way, in such a
> scenario, to avoid the generation of a table that contains only a member
> (the id a foreign key) that refers to the table of the base class?

No, that table is actually necessary for some functionality. Consider,
for example, a query that specifies a base class. Such a query should
return all the objects that are of the base class plus of any derived
class. ODB uses this (in your case empty) table to get that list.

Also, it seems strange to store in the database derived objects that
don't have any extra data.


More information about the odb-users mailing list