On Apr 20, 2007, at 12:45 PM, Steven Mark McCraw wrote:
Now we are getting somewhere! I have removed the mostly irrelevant bits.

Super!  I am dying to get to the root of this.

I am as well, this is puzzling.



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.

Have you tried creating a new KitQuantity and verifying that the to many relationships are non-null and instances of NSMutableArray?


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?

It might be worth trying to sub-class EOGenericRecord to see if it makes any difference. I am not aware of any problems related to ERXGenericRecord, but it is a good test to make anyway.

Even with this not happening, my suspicions still lie with object creation as that is the only time that you are seeing EOF corruption.



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.

Yes,  I should have warned you of that.  :-)


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={})>

That is good.


Then there is this line:

INFO NSLog - <class com.webobjects.foundation.NSNotification (name=ERXModelGroupAddedNotification, object=<EOModelGroup (("CCGStore", "file:/Library/Frameworks/ EclipseCCGStoreFramework.framework/Resources/CCGStore.eomodeld"), ("Karaoke", "file:/Library/Frameworks/EclipseKaraokeMisc.framework/ Resources/Karaoke.eomodeld"), ("erprototypes", "file:/Library/ Frameworks/ERPrototypes.framework/Resources/ erprototypes.eomodeld"), ("CCGAuth", "file:/Library/Frameworks/ EclipseCicadaUtility.framework/Resources/CCGAuth.eomodeld"))>, userInfo={})>

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={})>

So far, so good.


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)?

No, that is normal.

Try adding this to KitQuantity and create a new one:
public EOClassDescription classDescription()
{
        EOClassDescription description = super.classDescription();
        NSLog.out.appendln("KitQuantity classDescription: " + description);
        return description;
}



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.

OK



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.

My pleasure.


Chuck

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to