Fetching related objects in CoreData without NSManagedObject
Fetching related objects in CoreData without NSManagedObject
- Subject: Fetching related objects in CoreData without NSManagedObject
- From: Nick Zitzmann <email@hidden>
- Date: Tue, 20 May 2008 19:31:03 -0600
I've searched around and I'm confused about something.
I've got a data model with a many-to-one relationship. How do I:
1. Given the object on the "one" side, how do I get its related object
on the "many" side?
2. Given the object on the "many" side, how do I get all of the
objects on the "one" side?
This is trivial to do with SQL, but I don't see any direct SQL
interface in CoreData. Instead, I read <http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFetching.html#//apple_ref/doc/uid/TP40002484
>, and it is suggesting that I have to do something like [NSPredicate
predicateWithFormat:@"toOneRelationship == %@", toOneObject], but I
can't do that because I am not using NSManagedObject at all. (And I
have a reason why not - these model objects have to support multiple
back-ends in addition to CoreData, and ObjC does not support multiple
inheritance.)
So how do I query for related objects without NSManagedObjects?
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden