Reputation: 6359
Let's say I have one entity "Person" with many attributes and one relationship "shoes" to another entity "Shoe".
The "Person" entity has thousands of "Shoe"s. I have sometimes the need to retrieve just the attributes of this person but I don't need to download all the shoes.
Is it possible to fetch only a "Person" without its relationship "Shoe"?
And consequently, is it possible to fetch the relationship "Shoe" once we already fetched the "Person"?
Upvotes: 1
Views: 318
Reputation: 385650
What you are describing is how Core Data works by default. If you use a fetch request to get a Person
, then the returned object's shoes
property is a “fault”. A fault is an empty shell. When you first try to access a fault's contents (its properties or, in the case of a collection, its member objects), the fault “fires” by loading its contents from the database.
Read about faults in the Core Data Programming Guide.
Upvotes: 5