#1 2016-08-06 00:37:13

oraclei
Member
Registered: 2016-06-06
Posts: 18

CreateAndFillPrepareJoined fetch depth?

    TTourist = class(TSQLRecord)
    private
        fSchedule: TSchedule;
    published
            property schedule: TSchedule read fSchedule write fSchedule;
    end;
    
    TSchedule = class(TSQLRecord)
    private
        fDepartureDate: TDateTime;
        fBus: TBus;
    published
        property bus : TBus read fBus write fBus;
    end;
    
    TBus = class(TSQLRecord)
    private
        fLicense: RawUTF8;
    published    
        property license : RawUTF8 read fLicense write fLicense;
    end;

   
    When I call

        tourist := TTourist.CreateAndFillPrepareJoined(Client,
                   'schedule.DepartureDate>=? and schedule.DepartureDate<=?',
                   [],
                   [dateS1,dateS2]);

    the tourist record is loaded,which include schedule,bus bus is nil in schedule. how can I load all associate object, then I can access the sub object:

    tourist.schedule.bus.license; 

    thank for any clue!

Offline

#2 2016-08-06 08:36:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: CreateAndFillPrepareJoined fetch depth?

As documented only a joint of two tables is handled by the ORM.

Consider using sharding instead, and the aggregate pattern.

Offline

#3 2016-08-08 00:18:51

oraclei
Member
Registered: 2016-06-06
Posts: 18

Re: CreateAndFillPrepareJoined fetch depth?

Thank ab! sharding or aggregate pattern, it is more complicated, I could expense some time to understand it.

Offline

Board footer

Powered by FluxBB