Re: Occasional EOObjectNotAvailableException
Re: Occasional EOObjectNotAvailableException
- Subject: Re: Occasional EOObjectNotAvailableException
- From: "Lawson, Ben" <email@hidden>
- Date: Mon, 23 Nov 2009 17:07:38 +0100
- Acceptlanguage: en-US
- Thread-topic: Occasional EOObjectNotAvailableException
Good catch, I meant sorting with ERXArrayUtilities.
I'll try the one-liner, was looking to optimize that series of calls anyway, so thanks for that!
We're using the same database, same drivers. Enabling SQL debugging shows that when the EOObjectNotAvailableException is thrown, there was in fact no prior SQL call made. We're likely missing something (of course, otherwise it probably would be working), but it looks like EOF gives up on the fault of the object when sorting. The database isn't even queried to verify if the object with that ID exists (which it does).
-Ben
On Nov 23, 2009, at 4:31 PM, David Avendasora wrote:
>
> On Nov 23, 2009, at 9:59 AM, Lawson, Ben wrote:
>
>> Hey guys, hoping maybe one of you can shed light on this issue we've been having intermittently:
>>
>> We start by fetching all the rows out of a table using EOUtilities.objectsForEntityNamed(editingContext, entityName), and then filter that array with ERXArrayUtilities.sortedArraySortedWithKey(array, key).
>
> "filter that array" You aren't _filtering_ the array, you are sorting it.
>
> Since you are using Wonder and the Wonder eogenerator templates, you can achieve the same in one line by:
>
> NSArray myArrayOfEntities = Entity.fetchEntities(editingContext, qualifier, sortOrderings);
>
> Which will be much more efficient since it will make the DB do the filtering and sorting and only return the EOs that you actually want.
>
> If you really aren't filtering, then the qualifier can simply be null. You can also use the ERXKey functionality to make your sortOrding much easier to read:
>
> NSArray myArrayOfEntities = Entity.fetchEntities(editingContext, null, Entity.NAME.ascs());
>
>
>> The problem is that occasionally the sorting trips up ERXDatabaseContextDelegate.databaseContextFailedToFetchObject when faulting an element in the array (shouldn't this already have happened when building the NSArray from objectsForEntityNamed?).
>>
>> The objects we are fetching are the same as that throwing the error, so it's not a relationship fault that is causing the problem. I'm curious why this problem would occur in the sort instead of the fetch.
>
> I'm not sure. This is very strange. Try the above to see if it works any better.
>
>>
>> Finally, this problem only manifests itself in our test environment (a Solaris box) and not on our local development machines (iMacs). The application is built with all the frameworks embedded, and the OS X classpaths match the UNIX classpaths. We took the bundle that exhibited this issue and re-tested locally but the problem still only exists on the Solaris machine.
>
> Are you targeting the same database with the same driver? (this may be a red herring, but any time you say the code is identical but getting different data results, I'd look at the DB and the driver.
>
> Dave
>
>>
>> Thanks for the help,
>> -Ben _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>>
>
> David Avendasora
> Senior Software Engineer
> K12, Inc.
>
> *****
> WebObjects Documentation Wiki : http://wiki.objectstyle.org/confluence/display/WO/
> *****
> WebObjects API: http://developer.apple.com/legacy/mac/library/documentation/MacOSXServer/Reference/WO54_Reference/index.html
> *****
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden