[odb-users] Loading persistent object using custom joins

Patrick Rotsaert Patrick.Rotsaert at intoit.be
Mon Mar 4 08:34:02 EST 2013


Hi Boris,

On 4-mrt.-2013, at 14:26, Boris Kolpackov <boris at codesynthesis.com>
 wrote:

> Another option that I just thought of would be to extend the view
> mechanism to support loading directly into an object. In other words,
> we could have a special kind of view which is essentially just a way
> to create arbitrary joins for object queries. Something along these
> lines:
> 
> #pragma db view object(employer) object(employee)
> struct employer_loader
> {
>  // Lack of data members indicates we are loading the first
>  // associated object (employer).
> };
> 
> typedef odb::query<employer_loader> query;
> typedef odb::result<employer> result;
> 
> result r (db.query<employer_loader> (query::employee::age < 30));
> 
> What do you think?

This is exactly what I had in mind :)

Pat




More information about the odb-users mailing list