[odb-users] Automatically persist / update relations

Andreas Pasternak MT-Robot AG a.pasternak at mt-robot.com
Tue Sep 22 10:04:54 EDT 2015


Hello all,

I have:

#pragma db object
struct Val {
  short id;
  string value;
};
#pragma db object
struct Cont{
  std::vector> vals_rel;
}

To persist all of Cont I have to write:

Cont c;
db.persist(c);
for(val : vals_rel)
  db.persist(val);

But I'd like that ODB checks all relations automatically and inserts /  
updates them. The background is that I get the Cont class via network  
inclusive all data referenced by pointers and the recieving client  
might not have the related database entries yet.

Best regards,

Andreas


More information about the odb-users mailing list