Support of inheritance
![Post Post](./styles/sf/imageset/icon_post_target.gif)
QxOrm 1.1.3 builds fine with MinGW and all test cases work properly so I would like to integrate QxOrm into a project here. It is the first time I work with ORM so I have some questions about some things I'm not really shure about from reading the tutorial and the tests code.
From reading the code and the tutorial I would assume, that inhertitance is supported by QxOrm. In my application I have the folowing inheritance hirarchy:
Now in my application I need to work with the plain IContainer interface and I also need to work with the implementations (i.e. CTank). That means, I would like to read all containers from database into a container collection.
Is this possible with QxOrm. How is this implemented in the database? Does QxOrm create a table for each derived class? It would be create if the samples or the tutorial could be enhanced to show how to work with inheritance.
I tried the exe-dll1-dll2 test because it works with inheritance (CUser is derived from CPerson). But if I insert a CUser via qx::dao::insert(pUser) like it is done in the exe source then the CUser table contains 1 entry and the CPerson table is empty. So where is the data stored of the base class CPerson? Is there something I'm doing wrong?
From reading the code and the tutorial I would assume, that inhertitance is supported by QxOrm. In my application I have the folowing inheritance hirarchy:
- Code: Select all
// the interface
class IContainer
{
}
// has some data related to all containers that may contain fluid
class CFluidContainer : public IContainer
{
}
// this is a leaf in the inheritance hierarchy that implements a real container
class CTank : public CFluidContainer
{
}
// that is a leaf in the inheritance hierarchy for storage of pipettes
class CPipetteContainer : public IContainer
{
}
Now in my application I need to work with the plain IContainer interface and I also need to work with the implementations (i.e. CTank). That means, I would like to read all containers from database into a container collection.
Is this possible with QxOrm. How is this implemented in the database? Does QxOrm create a table for each derived class? It would be create if the samples or the tutorial could be enhanced to show how to work with inheritance.
I tried the exe-dll1-dll2 test because it works with inheritance (CUser is derived from CPerson). But if I insert a CUser via qx::dao::insert(pUser) like it is done in the exe source then the CUser table contains 1 entry and the CPerson table is empty. So where is the data stored of the base class CPerson? Is there something I'm doing wrong?