[odb-users] indirect relatioship between objects with std::vector<boost::variant<...>>

MM finjulhich at gmail.com
Sat May 26 07:05:27 EDT 2018


On 17 May 2018 at 16:43, Boris Kolpackov <boris at codesynthesis.com> wrote:
>
> MM <finjulhich at gmail.com> writes:
>
> > The behavior that I'm looking for is that if I persist A, then, I
> > would want my odb pragmas to persist the Xs and the Ys, but only if
> > they are not persisted already.
> >
> > Similarly,  if I load A, and the Xs and Ys instances are not loaded
> > already, I'd want to load them as well.
>
> Normally this kind of application-specific logic is best implemented
> using database operation callbacks and/or custom sessions.
>
> Boris

Looking at 14.1.7. callback pragma from the manual, would this be like

1. for persisting: A would have a member function that gets called
On pre_persist, the function would call persist() on the relevant X or Y object

2. for loading: A would have a member function that gets called
On pre_load: the function would load() the relevant X or Y object

Is it possible to have the called-back function not be a member function?

Thanks

MM



More information about the odb-users mailing list