[odb-users] Initial load with join

Sean Clarke sean.clarke at sec-consulting.co.uk
Thu Oct 30 09:29:35 EDT 2014


That sounds like an *excellent* feature Boris - have you an approx.
timeframe?

Regards
Sean Clarke
---------------------------------------------
SEC Consulting Limited
Phone: +44 (0)23 8040 5599
Website: http://www.sec-consulting.co.uk
Email: sean.clarke at sec-consulting.co.uk

On 30 October 2014 13:17, Boris Kolpackov <boris at codesynthesis.com> wrote:

> Hi Sean,
>
> Sean Clarke <sean.clarke at sec-consulting.co.uk> writes:
>
> >    doing some more evaluation with ODB, I don't know if I have missed
> > something - but is there a way to perform initial loads with a  join?
> > Similiar to teh Hibernate eager cache..... as an example:
> >
> > 3 classes and tables:
> >
> > Job
> > JobSheet
> > Address
> >
> >
> > A job has a jobsheet and an address: When I load a job is there away to
> get
> > the other two entities populated from the same initial load. Presently I
> > seem to get 3 separate SQL statements per load and this hugely effects
> > performance, especially over a WAN.
>
> Yes, ODB will use three separate statements to load each object. This is
> geared towards lazy loading (Section 6.4, "Lazy  Pointers").
>
> The ODB way to achieve what you want is to use views (Chapter 10). They
> not only allow you to load data from multiple objects, but you can also
> only load the data that you actually need.
>
> Now if you need to load all three objects completely, views can be quite
> awkward. To resolve this we are planning to add what we call object
> loading views. The syntax will be along these lines (not finalized yet):
>
> #pragma db view object(Job) object(JobSheet) object(Address)
> struct JobAndRelated
> {
>   std::shared_ptr<Job> job;
> };
>
> This feature is pretty high up on our TODO list.
>
> Boris
>


More information about the odb-users mailing list