Re: Mysterious field not reachable from entity error
Re: Mysterious field not reachable from entity error
- Subject: Re: Mysterious field not reachable from entity error
- From: John Larson <email@hidden>
- Date: Fri, 8 Sep 2006 05:33:34 -0500
Matt -
You're absolutely right that you can filter on functions, and if you
can see the data you should be there. But, there are two things I
don't understand. First, I've only ever seen the sql error message
when you are trying to put together a fetch specification for an
attribute that isn't in the model, but is in code. But, it doesn't
look like you're fetching from the db here. That's just a disclaimer
that I'm not sure what's happening there. Second, is the method
hasOpeningPlusZeroDays in the State class? If it is, then when you
filter on the array of galleries "galleriesActive()" EOQualifier
isn't going to find the field hasOpeningPlusZeroDays because it isn't
in the gallery's keypath. (assuming that the galleries is full of
galleries and not states) Lastly, I'm a little confused what you're
doing there at the end altogether, because it looks like you have a
circular reference: galleriesWithOpeningPlusZeroDays uses
hasOpeningPlusZeroDays and hasOpeningPlusZeroDays is using
galleriesWithOpeningPlusZeroDays.
John
> public NSArray galleriesWithOpeningPlusZeroDays(){
> EOQualifier qualifier =
> EOQualifier.qualifierWithQualifierFormat("hasOpeningPlusZeroDays =
> 'true'",null);
> return EOQualifier.filteredArrayWithQualifier
( galleriesActive(),
> qualifier).mutableClone();
> }
>
> public boolean hasOpeningPlusZeroDays(){ return
> (galleriesWithOpeningPlusZeroDays().count() > 0); }
On Sep 7, 2006, at 11:58 PM, Matt Kime wrote:
I really don't understand. Are you saying that I should write a
function to do the comparison? Nothing I saw in the JavaDoc explains
why I can't search objects on the result of a function although I'm
getting an error that says that the function isn't available. I have
no trouble taking the info I'm searching on and displaying it in the
WOComponent I'm working on.
thanks,
matt
On 9/4/06, Jerry W. Walker <email@hidden> wrote:
Hi, Matt,
Take a look at the EOQualifier JavaDoc and search for "Using
Selectors in Qualifier Expressions".
I think you'll find your answer there.
Regards,
Jerry
On Sep 3, 2006, at 10:42 PM, Matt Kime wrote:
> I have an object with the code below. When I try this search from a
> WOComponent - EOQualifier.qualifierWithQualifierFormat
> ("hasOpeningPlusZeroDays
> = 'true'" ,null); I get the error below. I don't understand why I'm
> getting this error. hasOpeningPlusZero days is clearly reachable.
>
> Can anyone provide a better debug message? I really don't
understand
> why I'm getting this error.
>
> thanks,
> matt
>
>
> ---
>
> java.lang.IllegalStateException: sqlStringForKeyValueQualifier:
> attempt to generate SQL for
> com.webobjects.eocontrol.EOKeyValueQualifier
(hasOpeningPlusZeroDays =
> 'true') failed because attribute identified by key
> 'hasOpeningPlusZeroDays' was not reachable from entity 'State'
>
> ---
>
> code from 'State' object
>
> public NSArray galleriesActive() {
> EOQualifier qualifier =
> EOQualifier.qualifierWithQualifierFormat("parentID = nil AND
status =
> 1",null);
> NSMutableArray EOArray =
EOQualifier.filteredArrayWithQualifier(
> galleries(), qualifier).mutableClone();
>
> EOSortOrdering galleryOrdering =
> EOSortOrdering.sortOrderingWithKey("name",
> EOSortOrdering.CompareCaseInsensitiveAscending );
> NSArray sortArray = new NSArray(galleryOrdering);
> EOSortOrdering.sortArrayUsingKeyOrderArray
(EOArray, sortArray);
> return EOArray;
> }
>
> public NSArray galleriesWithOpeningPlusZeroDays(){
> EOQualifier qualifier =
> EOQualifier.qualifierWithQualifierFormat("hasOpeningPlusZeroDays =
> 'true'",null);
> return EOQualifier.filteredArrayWithQualifier
( galleriesActive(),
> qualifier).mutableClone();
> }
>
> public boolean hasOpeningPlusZeroDays(){ return
> (galleriesWithOpeningPlusZeroDays().count() > 0); }
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
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