On Nov 26, 2008, at 9:22 AM, Henrique Prange wrote:

Hi Chuck,

Chuck Hill wrote:
From your descriptions, it sounds like the models are not getting connected with the same connection dictionary. Try using the EOUtilities method: public static EODatabaseContext databaseContextForModelNamed(EOEditingContext ec, String name) To get the EODatabaseContext and EODatabase from each model and test if they are the same objects or not. They should be the same.

I did what you suggested. I added the code to execute as soon as Main component is loaded. I get the following result:

Database context for model A:
  [EMAIL PROTECTED]

Database context for model B:
  [EMAIL PROTECTED]

Is database context equals? true

So, they are equals. That it is not the problem. Wait... I tried to search and edit an object with the problem I described. Surprisingly, it worked. Problem solved. Let me remove the test code I added. Stop the application, start and... I can't edit the object again because of the same exception I've reported.

So, if I leave the code to test database context equality at session's startup, the application works. If I remove the code, I get the exception. I tried 3 times both situations. The exception always appears when there is no test code. And the application always works when the test code is there. Weird.

Any ideas? :p


If the models are not connected, I think this code will cause them to connect. Is this running before or after the code you added to connect models? You really want it to run after (well, really, want your model connection code to run as early as possible so that it catches and and all notifications). I am guessing that perhaps your model connection code is running too late and so not affecting one (or both) of the models.

Chuck


--
Chuck Hill             Senior Consultant / VP Development

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      ([email protected])
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