[odb-users] Inheritance

Jan Kuentzer kuentzer at googlemail.com
Thu Jul 7 11:17:59 EDT 2011


Hi Boris,

I am facing some problems concerning inheritance and hope that I only missed
something. We have some data structure like the following:

class employee
{...}

class permanent_employee: public employee
{...}

 class temporary_employee: public employee
{...}

class company
{
    std::vector<employee*> employees;
}

If we generate with ODB the sql each class get it's own table and the vector
is associated with employee ids. But the stored objects are sometimes
instances of permanent_employee, temporary_employee or employee.
Therefore the object ids are not correct in the database since for queries
ODB always searches for the corresponding entries in employee, where they
cannot be found (it is stored in the derived class tables)
Did I understand something wrong and there is a workaround for that? Or is
this what you meant with chapter 8.2 which will come in the future?

Thanks for you help!

Best

       Jan


More information about the odb-users mailing list