Core Data not-reverse relationship subquery
Posted
by
user561485
on Stack Overflow
See other posts from Stack Overflow
or by user561485
Published on 2011-01-03T16:52:05Z
Indexed on
2011/01/03
16:53 UTC
Read the original article
Hit count: 169
objective-c
|core-data
Hi,
I have the following entities in CoreData:
Village - villageID
Bookmark - (relation) village
There are multiple villages with each an unique villageID. I have a entity Bookmark which only has a relation to a Village entity; it isn't possible to make a reverse relation.
Now I would like to get the village entities where there exists a Bookmark relation. I've red something about subqueries, but I can't get it right for this situation.
It must be something like: Village.villageID IN (Bookmark.village.villageID)
It isn't possible to get first all the Bookmarks and then loop to get all the Villages, because of the design of the framework.
Can this be done in CoreData (I presume the answer is "Yes, of course!") and how?
© Stack Overflow or respective owner