Refresh a core data relationship
Asked Answered
A

1

6

Is it possible to refresh a particular relationship of a Core Data managed object? I know I can refresh the entire object but I would just like to refresh a particular relationship. I imagine I would accomplish this by causing the relationship to be a fault again but I can't seem to find anything to accomplish this. You can check is a particular relationship is a fault but you can't force one to be a fault.

Amphibious answered 12/12, 2011 at 22:50 Comment(1)
Is there a solution to this problem? CoreData's refresh method seems to refresh both the object and all of its relationships...Quiet
S
0

I'm guessing because I'm not sure what you mean by "refresh". If it is faulted (not "realized" or not retrieved from the store), it will refresh when your code needs to access it. If you want to refresh many objects and relationships, you can do that as described in “Batch Faulting and Pre-fetching with the SQLite Store”

If I have misunderstood, can you provide some clarification, please?

Subplot answered 12/12, 2011 at 23:42 Comment(1)
I have an entity A that is NOT faulted. It has several relationships which are NOT faulted. I would like to force a particular relationship to be a fault so that that relationship is fetched from the store when it is accessed again. "Refresh" refers to the "refreshObject" method on NSManagedObjectContext.Amphibious

© 2022 - 2024 — McMap. All rights reserved.