efficient way to gather secondary objects


Looking for a way to do this efficiently: With class A I’ve done a query to get an RLMResults of some A objects. One of class A’s attributes is a pointer to class B. What’s an efficient way to get an RLMResults of the B’s that are pointed to by that list of A’s?

Pseudocode, stripped down from the original Objective-C

@interface A : RLMObject
@property B* referencedObject;
@property NSString* mynameroot;
// other stuff

+ (RLMResults*)references:(NSString*)parameter
    RLMResults* temp1 = [TJJoin objectsWhere:@"mynameroot==%@",parameter];
    // now have a list of the appropriate As
    // need a list of the Bs that are pointed to by those As
    RLMResults* temp2 = [temp1   ????
    return temp2;


Do you really need the second query? If you make an inverse relationship between A and B then you have access B on the model A.

You can read more about it here:


The A is actually a join table. I wanted to have the inverse relationship, but each join has unique properties, so I had to keep a separate table. The intent here is to find all the A joins that match a query, then find the B objects pointed to by that set.


Then I would go from the other side:
build a query on Object B, where object.relationShip.propery == XXX
That should work, but I’m not sure…