我需要用一个与另一个实体有关系的实体与另一个实体建立一个谓词。这可能吗?我有以下实体:
Entity: BOOK
Entity: AUTOR
Entity: SCHOOL
而这些关系:
BOOK -> relationAutor <- AUTOR
AUTOR -> relationSchool <- SCHOOL
SCHOOL -> attribute "country"
所以,我需要从特定的country
. 因为我通过实体 AUTOR 从实体 BOOK 到属性country
(来自实体 SCHOOL)有一些关系,所以我尝试连接这个谓词:
NSString *pred = [[NSPredicate predicateWithFormat:@"relationAutor.relationSchool.country IN %@",[countries valueForKey:@"country"]]predicateFormat];
predicateFormat = [predicateFormat stringByAppendingFormat:@" AND (%@)",pred];
但我的代码崩溃:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unimplemented SQL generation for predicate : (relationAutor.relationSchool.country IN {France})'
我想要做的甚至可能吗?如果是,我将如何构建这样的谓词?