[odb-users] ODB 2.5.0-b.19 self-referential attribute mapping error

Craig Burton rccraigb at gmail.com
Mon Sep 28 14:17:46 EDT 2020


Thank you, that was it!

Much appreciated,
Craig

On Mon, Sep 28, 2020 at 4:43 AM Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Craig Burton <rccraigb at gmail.com> writes:
>
> > #include <odb/core.hxx>
> > #include <boost/shared_ptr.hpp>
> > #include <boost/weak_ptr.hpp>
> >
> > #pragma db object table ("Node")
> > class Node
> > {
> > protected:
> >    friend class odb::access;
> >    #pragma db id auto
> >    unsigned long id_;
> >
> > private:
> >    boost::shared_ptr<Node> _above;
> >
> >    #pragma db value_not_null inverse(_above)
> >    std::vector<boost::weak_ptr<Node> > _below;
> > };
> >
> > /usr/local/odb-2.5.0/bin/odb \
> > --database mysql \
> > --std c++11 \
> > --generate-schema \
> > --generate-query \
> > --profile boost/date-time \
> > --generate-session \
> > --at-once \
> > --input-name Depot \
> > -I/home/cburton/Development/odb-2.5-runtime/odb/include \
> > -I/usr/local/boost_1_62_0 Node.h
>
> I am pretty sure you need to enable the boot/smart-ptr profile (which
> includes traits for boost::*_ptr and makes boost::shared_ptr the default
> object pointer).
>


More information about the odb-users mailing list