[odb-users] Lazy Relationships?

Christian Sell christian at gsvitec.com
Sun Sep 20 06:31:48 EDT 2015


Hello,
 
just now I realize that when I load an object that has relationships, all
relatioships are loaded as well (and that using plain select statements without
<outer> join.. duh). This can obviously be a real performance issue. The only
solution I have found so far is using a section. However, that requires a
section instance variable in the mapped class, which is not easily done for me,
since I am mapping library classes.
 
We do, however, already have our own collection classes which I intend to make
known to ODB using the collection_traits mechanism. These containers are also
used to implement relationships (i.e., containers with shared pointers to mapped
classes).
 
My questions:
 
- does the collection_traits mechanism allow us to implement relationships in
the way described above?
- if it does, is there a way to make relationship resolution lazy, such that the
rlationship is only loaded on demand (e.g., when I say department->employees)?
 
thanks,
Christian


More information about the odb-users mailing list