[odb-users] ODB exception on insert (ODB 2.4.0)

Boris Kolpackov boris at codesynthesis.com
Mon Jun 8 09:42:48 EDT 2020

Craig Burton <rccraigb at gmail.com> writes:

> I am encountering the following exception upon attempting to insert a
> derived class that inherits from two classes, one defined as polymorphic,
> the other as abstract: [...]

I've checked and this bug is still present in 2.5.0.

However, before fixing it, we would need to understanding whether
mixing the two inheritance styles is even something that makes
sense and that we want to support. And the answer is likely "no"
(this stuff is already complex enough).

You can also achieve what you (probably) want with a transient base
and a virtual data member:

//#pragma db object transient
class AbstractBase
   std::string mAbstractBase;

#pragma db object
class PersistentDerived
  : public PersistentBase, AbstractBase

   #pragma db member(mAbstractBase_) virtual(std::string) access(mAbstractBase)
   std::string mDerived;

More information about the odb-users mailing list