[odb-users] Looking for the most efficent way to load a object hiearchy

Sverre Eplov sverre at awion.dk
Tue Nov 17 11:21:42 EST 2015


Hi,

I am currently playing “getting to know ODB”, and I think I’ve worked out how to do most of what I want to do. 

There is one thing I can’t really work out - what is the most efficient way to load into memory a object hierachy, where some objects have a one-to-many relationship to other objects. 

          
So if I have tables A, B, C and D, where 

 - A have a one-to-one relationship to B
 - B have a one-to-many relationship to C
 - C have a one-to-many relationship to D

Example instance graph:

A - B + C1 
      + C2
      + C3 + D1
           + D2


I would now like to load a number of A’s (say, about 200) with full object graph as well. How can this be done most efficiently ? I can’t see a way using object views, as they do not allow the objects they load to have collections in them. 

I don’t exactly need actual code for this, more a general descriptoin of the best way to achieve loading of a complete hierachy. Lazy loading won’t do, as I need to serialize the whole bazinga and ship it over a wire to a client app. 


(BTW, the background is that in order to test out ODB, I’m reconstructing in C++ a solution I’ve done for a customer in C#, where I have used the Entity Framework as ORM and WPF frontend. I’m redoing in C++ using ODB and QT. )


Best Regards,
 /Sverre Eplov


More information about the odb-users mailing list