Attempt To Insert Nil Pops Up After Sometime.
Attempt To Insert Nil Pops Up After Sometime.
- Subject: Attempt To Insert Nil Pops Up After Sometime.
- From: email@hidden
- Date: Wed, 10 Mar 2004 12:37:31 -0500
- Priority: normal
Thanks everyone for responding to the post titled Inserting/Deleting Records From Within EOGenericRecord
I have implemented most of the recommendations by the people (some of the code was overkill because I was trying everything).
So here is the scenario : I am trying to insert from within an EOGenericRecord (Subscriber.java) and here is the code where the error comes up within the EOGenericRecord (or custom class generated by the EOModel, a class called Subscriber.java).
public void subscribeTo(Lists list){
EOEditingContext ec = this.editingContext();
Subscription subscription = (Subscription)new Subscription();
ec.insertObject(subscription);
this.addObjectToBothSidesOfRelationshipWithKey(subscription,"toSubscriptions");
subscription.setSubscriberId(this.subscriberId());
> ec.saveChanges();
}
The error comes up right before it tries to save changes to the subscription object inserted into the editing context.
NSInvalidArgumentException: Exception while evaluating takeValue:forKeyPath:'child1.grade', on target:<EditEverything 0xb64390>:
*** -[NSConcreteMutableArray addObject:]: attempt to insert nil
Stack Trace:
Not available.
Following is tangential and extra information:
It mentions takeValue:forKeyPath:'child1.grade' because the call to the method Subscriber.subscribeTo(list) is called from the setter methods (setGrade) of the EOEnterpriseObject child1. EditEverything.java is the page where the WOComponent is saving or editing the child EO.
So when I click submit in the WOComponent EditEverything.java it goes to the child1.setGrade(value) which calls child1.toSubscriber().subscribeTo(list). Now when I edit the grades of the children and save them subscribeTo(list) (and the whole process) works like clockwork for the first 3-4 times. However after the 3-4th time I get the "attempt to insert nil" error.
Now here is the relationship diagram:
Children <<-> Subscriber <->> Subscription <<-> Lists
The relationship toSubscriptions (from subscriber.java) is 1 - to - many relationship which owns its destination. And the reciprocal relationship toSubscriber (from Subscription) is also a to-1 relationship which takes No Action if Subscription is deleted.
--
I guess my question is : it works fine when I change grades of the child (from the WOComponent EditEverything) back and forth and subscriptions change automatically for the first 3-4 times until suddenly the "attempt to insert nil" pops up.
A. Shiraz
44 Executive Boulevard
Elmsford, NY 10523
(914) 592- 4203 x268
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.