[odb-users] sqlite, one to many relationship, std::map,
boris at codesynthesis.com
Thu Jan 17 12:41:28 EST 2013
Daniel James <danielpeterjames at gmail.com> writes:
> > "An inverse member does not have a corresponding column or, in case
> > of a container, table in the resulting database schema. Instead,
> > the column or table from the referenced object is used to retrieve
> > the relationship information. Only ordered and set containers can
> > be used for inverse members. If an inverse member is of an ordered
> > container type, it is automatically marked as unordered."
> What's the rationale for not enabling std::map but enabling std::set
> and 'ordered' containers?
The explanation is actually in the above passage I quoted from the
manual. The inverse container doesn't have its own table and thus
there is no place to store the map's key. The entries for this
container are "inferred" from the entries for the direct side of
the relationship. Section 6.2, "Bidirectional Relationships" in
the ODB manual has more information on this.
One way to make map "work" in your example would be to make the
other side inverse instead.
More information about the odb-users