First, you must do your best to get out of SQL thinking. Master data is not ORM. This is an object graph management structure that simply uses SQLite as one possible backend. Although you can see the SQL that it uses through environment variables (for debugging), SQL is a private implementation detail. Master data could be implemented without any SQL.
So, try not to think in terms of db tables. You have a collection of Deal isntances. Do you want their properties? Use Key-value Coding to get the properties of these instances and their associated Instrument instances. Assuming you have an NSSet instance of Deals called Deals :
[deals valueForKey:@"dealProperty"];
will give you an NSSet of dealProperty values ββfrom each instance of Deal . If you want to get several properties at once, you can use -[NSObject(NSKeyValueCoding) dictionaryWithValuesForKeys:] . Using this method, you can get the keys "only one level", so only for example. 'dealProperty1', 'dealProperty2', but not 'dealRelation.relationProperty' or 'dealRelation. @count '.
To get the "nested" properties, simply use the key path:
[deals valueForKeyPath:@"instrument.instrumentProperty"];
will provide you with a set of instrumentProperty values ββfor the Instrument instance associated with each Deal instance, assuming Instrument is a one-to-one relationship from Deal to Instrument . If you have a one-to-many relationship, you get a set of sets of instrumentProperty values.
You can always do this more explicitly (obviously, this code does nothing and is not even syntactically correct, since I missed the semicolon, etc., but it shows the diagram):
for(Deal *deal in deals) { //use attribute access to get properties of deal and associated instrument deal.dealProperty deal.instrument.instrumentProperty //for one-to-one for(Instrument *instrument in deal.instruments) { //for one-to-many instruments instrument.instrumentProperty; } }
using an enumeration of the relevant collections.