Relationship on parent not observed properly for subentity (was: Abstract entities and relationships)
Relationship on parent not observed properly for subentity (was: Abstract entities and relationships)
- Subject: Relationship on parent not observed properly for subentity (was: Abstract entities and relationships)
- From: Charilaos Skiadas <email@hidden>
- Date: Wed, 13 Jul 2005 12:49:41 -0500
Upon further examination, this has nothing to do with abstract
classes. If a relationship "rel1" is set up to an entityA from an
entityC, with inverse "rel2", and "item" is an object of entityB, a
subentity of entityA, then setting the value for rel2 does not update
rel1 as well.
Further, this can be saved with no problems, and it is clear in the
XML that, will "item" points through rel2 to its corresponding thing
of entityC, that thing does not point back.
Should I consider this a bug?
On Jul 13, 2005, at 3:15 AM, Charilaos Skiadas wrote:
I have three entities:
1) GradeItem is an abstract entity. It has a to-one relationship
"type" to entity GradeType.
2) ConcreteGradeitem is an entity with parent GradeItem.
3) GradeType is an entity with a to-many relationship "gradeItems"
to GradeItem, inverse to "type".
Now, I create an object of type 2 in code, and set its type through
setValue:forKey: The code is basically:
NSManagedObjectContext *theContext = [self managedObjectContext];
NSManagedObject *item = [NSEntityDescription
insertNewObjectForEntityForName:@"ConcreteGradeItem"
inManagedObjectContext:theContext];
[item setValue:type forKey:@"type"];
Now, I would expect that gradeItems would be updated from this,
since it is inverse to type. However it doesn't, as looking at the
XML file shows. If one the other hand I use
NSManagedObject *item = [NSEntityDescription
insertNewObjectForEntityForName:@"GradeItem"
inManagedObjectContext:theContext];
instead, then it does get updated.
Now, I would expect that it should not matter to GradeType, which
of the two I use, but it does. Is this a misconception on my part,
or a bug?
thanks,
Haris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40math.uchicago.edu
This email sent to email@hidden
Haris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden