Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CoreData: Inverse relationships not maintained (to-one on one size, to-many on the other, with abstract classes)



On May 31, 2005, at 3:15 PM, Jim Correia wrote:

I have a data model with abstract entities in the hierarchy. The Item object knows about its root container (to one relationship), and the container object knows about its items (too many relationship.)

If I manually set the value for one side of the relationship, the other side isn't maintained automatically. I've built a fictitious app which demonstrates the problem.

I did some more digging.

If I run the following code:

// now let's poke at the entities and see what there is to be learned about the relationships

NSEntityDescription *libraryItemEntity = [NSEntityDescription entityForName: @"LibraryItem" inManagedObjectContext: context];
NSEntityDescription *libraryNodeEntity = [NSEntityDescription entityForName: @"LibraryNode" inManagedObjectContext: context];


NSLog(@"%@", [[libraryItemEntity relationshipsByName] objectForKey: @"root"]);
NSLog(@"%@", [[libraryNodeEntity relationshipsByName] objectForKey: @"items"]);



At runtime I get:

2005-05-31 17:07:55.582 BrokenInverseRelationships[8826] (NSRelationshipDescription), name root, isOptional 0, isTransient 0, entity LibraryItem, validation predicates (), warnings (), destination entity RootNode, inverseRelationship items, minCount 1, maxCount 1
2005-05-31 17:07:55.582 BrokenInverseRelationships[8826] (NSRelationshipDescription), name items, isOptional 1, isTransient 0, entity LibraryNode, validation predicates (), warnings (), destination entity LibraryItem, inverseRelationship (null), minCount 0, maxCount 0



The inverse relationship for the Library node, items relationship is (null) in the output, which is awfully suspicious looking. (Especially given that the inverse is set in the data model.


Have I bumped into a bug? I can write it up if necessary. (If I have and there is a ready workaround, I'm all ears.)

Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >CoreData: Inverse relationships not maintained (to-one on one size, to-many on the other, with abstract classes) (From: Jim Correia <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.