[odb-users] Persisting class instantiated from a template

Boris Kolpackov boris at codesynthesis.com
Wed Mar 15 11:22:10 EDT 2017


Hi Balázs,

Balázs Bayer <balazs.bayer at gmail.com> writes:

> typedef Result<float, 7> ResultFloatSeven;
> #pragma db value(ResultFloatSeven) definition transient
> #pragma db member(ResultFloatSeven::getId) virtual(int) access(getId)
> #pragma db member(ResultFloatSeven::getValue) virtual(float) access(getValue)

You are using function names for virtual member names so ODB tries to
derive modifier names from these function names which is not what you
want. Try to change this to:

#pragma db member(ResultFloatSeven::Id_) virtual(int)
#pragma db member(ResultFloatSeven::Value_) virtual(float)

Also, I don't think you need to go through the virtual member route
in this case. ODB should be able to map everything automatically with
just:

typedef Result<float, 7> ResultFloatSeven;
#pragma db value(ResultFloatSeven) definition

Boris



More information about the odb-users mailing list