Hi Mark,
Now we are getting somewhere! I have removed the mostly irrelevant bits.
Super! I am dying to get to the root of this.
There was nothing in them at all last night when I tested. I went ahead and uncommented everything this morning, because it seemed to have no effect. The superclasses are just the generated classes from EOGenerator. The only unusual thing about them is that I had to change the template for the to-many relationships to make sure that they returned an empty array rather than null if no relationships had been set,
RIght here. This is where the red lights flash and the sirens start whooping. This is also a symptom of the problem but it much closer to the problem. Until you fix this, EOF is not right and you are wasting time trying to fix a symptom of a deeper, underlying problem.
Does this happen for both newly created objects and fetched existing objects? Just one of them? Does it happen for all EOs or just some of them? Usually this means that you have forgotten a call to super.awake... in awakeFromFetch or awakeFromInsertion. Are you using inheritance at all? Check all the way up the inheritance chain, even into frameworks.
Ok, I have reverted to the original template that came with EOGenerator, I have regenerated all of my EOs, and recompiled. So far, I have not hit the NullPointerException difficulties that I used to have with the old template. As I recall, the previous issue applied to all objects that referenced a to-many relationship which had no foreign rows defined yet, whether the object was new or not. The only thing that I changed in the EOGenerator template (I used EOGJavaSource.eotemplate) was importing er.extensions.ERXGenericRecord and making everything subclass ERXGenericRecord. Could this be a mistake? Should I go back to subclassing EOGenericRecord?
The only other reason that this would happen is if it failed to find a ClassDescription for the entity. It uses model information to determine what relationships to initialize. Right now, I suspect that this is your problem. Add your application as an omniscient observer to NSNotificationCenter and log out all notifications. That will probably show where the problem starts.
ok, my application is now an omniscient observer, and holy cow, there is a lot of logging coming out. The relevant part seems to be at startup, and sure enough, for every table in the model, there is a line that looks like this:
INFO NSLog - <class com.webobjects.foundation.NSNotification(name=EOEntityLoadedNotification, object=<EOEntity CatalogItem 2061482>, userInfo={})>
Then there is this line:
Then, (again for every table in each of the EOModels I am loading) there is a line that looks like this:
INFO NSLog - <class com.webobjects.foundation.NSNotification(name=EOClassDescriptionNeededForEntityNameNotification, object=CatalogItem, userInfo={})>
When I actually do things in the application, a ton more stuff comes out, but I'm not sure how much is relevant. Is there something else I should be looking for? What does EOClassDescriptionNeededForEntityNameNotification mean? Does this signify some kind of problem with my EOModel(s)?
Now, before you do that, you might want to look at the model again. Are you sharing classes across entities (have multiple entities using the same class name)? Are some of the entities in another model that is not getting loaded? Are using inheritance with non-unqiue restricting qualifiers?
Chuck
I am not sharing classes across entities, and it appears all my models are getting loaded from all the included frameworks. I am not using inheritance anywhere.
That is because you hid the earlier symptom of the real problem.
Good to know. I'll be thrilled to find the real problem so that I can avoid it in the future. Thanks again for the help.