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

MM finjulhich at gmail.com
Sun May 27 23:18:44 EDT 2018

On 26 May 2018 at 12:05, MM <finjulhich at gmail.com> wrote:
> 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

It appears the callback pragma doesn't apply to value types, and it's
just ignored.
The odb compiler doesn't generate warnings for that.
Can this pragma apply to value types too?


More information about the odb-users mailing list