[odb-users] Object and value at the same time.

Andreas Pasternak a.pasternak at mt-robot.com
Wed Oct 21 10:31:55 EDT 2015


Hello all,

I have a C++ class which I want to use as a value and an object in 
different contexts:

#pragma db value and object // This command is missing for me
class Foo {
int id;
}
#pragma db object
class Bar{
  Foo m_member;
}

Bar bar;
Foo foo;

db.persist(bar)
db.persit(foo)

I can either use Foo in Bar OR I can persist foo. Not both at the same 
time. Of course I can always create object with the value as member but 
I'd like to avoid that.

Best regards,

Andreas


More information about the odb-users mailing list