[odb-users] Feature request: relationships not in pointers

Boris Kolpackov boris at codesynthesis.com
Tue Jul 24 06:02:30 EDT 2018


Feiyun Wang <feiyunw at yahoo.com> writes:

> In the ODB manual, Chapter 6 Relationships:> Relationships between
> persistent objects are expressed with pointers or containers of pointers. I
> suggest to add the support for relationships expressed in the ODB pragma
> language.

This has already been implemented:

https://git.codesynthesis.com/cgit/odb/odb/commit/?id=e78db08d98d5adb4dee3006eea8c3569e383c562

It is not yet documented in the manual, but the basic usage is:

#pragma db object
class obj1
{
  #pragma db id
  int id;

  ...
};

#pragma db object
class obj2
{
  ...

  #pragma db points_to(obj1)
  int o1;
};


Note also that in your case you may also consider lazy object pointers. You
could just unload all the pointer before passing things to another thread.



More information about the odb-users mailing list