[odb-users] Relational tables with an association table

Boris Kolpackov boris at codesynthesis.com
Thu Jul 18 08:43:07 EDT 2013


Hi Adam,

Adam Walters <adam at navigatesurgical.com> writes:

> In this (somewhat simplified) example [...]

I couldn't really follow what you are trying to achieve. When describing
such complex relationships (I would by no means call it "simple"), it is
always a good idea to show some concrete class declarations and their
relationships.

Two things that sound like they might be useful in your case:

1. Inverse pointers. Basically, if you have an A-to-B relationship,
   you can also get the B-to-A relationship for free (i.e., without
   any database columns/tables). This way you can access the other
   side of the relationship from either end. See Section 6.2, 
   "Bidirectional Relationships" for details.

2. You can use views to join multiple objects in pretty much any
   way you want and pull any subset of data from them. This is the
   swiss army knife of relationship slicing and dicing. See Chapter
   9, "Views" for details.

If non of these seem to apply to your case, then maybe you could
try to sketch the C++ classes you have so that I can try to 
understand the problem better.

Boris



More information about the odb-users mailing list