Re: Core Data fetch with to-many relationship

2009-09-09 Thread Ben Trumbull
When I log the test fetch results: NSArray *testFetchResults = [managedObjectContext fetchObjectsForEntityName:@"Owner" withPredicate:[NSString stringWithFormat:@"ANY books.name like 'myPrefix*'"]]; NSLog([[(Owner *)[testFetchResults objectAtIndex:0] books] valueForKey:@"name"]); I get the follo

Re: Core Data fetch with to-many relationship

2009-09-09 Thread Alex Reynolds
I think I found a solution: NSArray *testFetchResults = [managedObjectContext fetchObjectsForEntityName:@"Owner" withPredicate:[NSString stringWithFormat:@"ANY books.name beginswith 'myPrefix'"]]; NSSet *filteredSet = [(NSSet *)[(Owner *)[testFetchResults objectAtIndex:0] buckets] filtere

Re: Core Data fetch with to-many relationship

2009-09-08 Thread Alex Reynolds
Hi Melissa, Thanks for the name change suggestion. When I log the test fetch results: NSArray *testFetchResults = [managedObjectContext fetchObjectsForEntityName:@"Owner" withPredicate:[NSString stringWithFormat:@"ANY books.name like 'myPrefix*'"]]; NSLog([[(Owner *)[testFetchResults object

Re: Core Data fetch with to-many relationship

2009-09-08 Thread Melissa J. Turner
On Sep 8, 2009, at 18:03, Alex Reynolds wrote: Relationship fault for (), name Book, isOptional 1, isTransient 0, entity Owner, renamingIdentifier Book, validation predicates ( ), warnings ( ), versionHashModifier (null), destination entity Book, inverseRelationship Owner, minCount 0, max

Core Data fetch with to-many relationship

2009-09-08 Thread Alex Reynolds
I am having trouble fetching results with a to-many relationship and would like to ask for advice. I have two NSManagedObject subclasses: Owner and Book. There is a one- to-many relationship between Owner and Book (an Owner can be associated with many Books). @interface Owner : N