[odb-users] Mapping abstract

Bright Dadson losintikfos at yahoo.co.uk
Sun Aug 14 15:12:16 EDT 2011


I have a file called `Account.h` as shown below:

    #ifndef ACCOUNT_H_
    #define ACCOUNT_H_

   //forward declaration of address
   class Address address;
    
    #pragma db object abstract
    class Account
    {
      //fields and methods
      //Inverse bi-directional mapping to Address 
    };
    #endif /* ACCOUNT_H_ */

I also have a second file called `Address.h` as shown below:

    #ifndef ADDRESS_H_
    #define ADDRESS_H_
    #include "Account.h"
    
    typedef Account account_type;//Error her
    class Address
    {
     //Fields and methods
    };
    #endif /* ADDRESS_H_ */

My problem is, when I try to map to Account, I get the error `Account is Abstract`. I want to be able to map to the abstract instead of mappping to each base class - I think doing it this way will remove the verbosity of the mapping code across inherited classes.

Is there a simple way of doing this, can I map to the abstract base class, so all children classes will inherit this? Also Is my forward declaration of Address in Account correct? well considering they are different files.

Thanks.


More information about the odb-users mailing list