[odb-users] One-to-many bidirectional relationship without intermediary table

Boris Kolpackov boris at codesynthesis.com
Tue Oct 15 10:08:41 EDT 2019

Mocnik Marko <marko.mocnik at lisec.com> writes:

> But how do I get now a bidirectional mapping? Especially a vector of
> Testi2 s in Testi? Also with a virtual data member?

For the other direction you would want to use the inverse pragma,
something along these lines:

struct testi2;

#pragma db object
struct testi
  #pragma db id
  int asdf;

  #pragma db inverse(id.asdf)
  std::vector<testi2*> testi2s;

For more information on the inverse pragma, see:


More information about the odb-users mailing list