Skip to content

Single Step Retrieval

Important

Single Step Retrieval loads only a partial set of the related objects (default size of the retrieved related collection is 10). To load additional related objects, use the Relation Paging API.

This approach allows retrieval of a partial set of the related objects along with the parent object in a single findor findById request. Each relationship property (column) must be uniquely identified by name using the API documented below.

DataQueryBuilder *queryBuilder = [DataQueryBuilder new];
[queryBuilder setRelatedWithRelated:@[@"RELATED-PROPERTY-NAME", @"RELATED-PROPERTY-NAME.RELATION-OF-RELATION"]];

[dataStore findWithQueryBuilder:queryBuilder responseHandler:^(NSArray *foundObjects) {
    NSLog(@"Found objects: %@", foundObjects);
} errorHandler:^(Fault *fault) {
    NSLog(@"Error: %@", fault.message);
}];
let queryBuilder = DataQueryBuilder()
queryBuilder.setRelated(related: ["RELATED-PROPERTY-NAME", "RELATED-PROPERTY-NAME.RELATION-OF-RELATION"])

dataStore.find(queryBuilder: queryBuilder, responseHandler: { foundObjects in
    print("Found objects: \(foundObjects)")
}, errorHandler: { fault in
    print("Error: \(fault.message ?? "")")
})

where

Argument                Description
dataStore data store created using dictionary or class-based approach.                        
RELATED-PROPERTY-NAME name of a related property to load. For example, if table Person has a relation "homeAddress" pointing to an object in the Address table, the value would be "homeAddress". The syntax allows to add relations of relations. For example, if the same Address table has a relation "country" pointing to the Country table, then "homeAddress.country" would instruct the related Country object to be loaded as well.