Re: EOQualifier and to-many relationships
Re: EOQualifier and to-many relationships
- Subject: Re: EOQualifier and to-many relationships
- From: Ramsey Gurley <email@hidden>
- Date: Fri, 14 Dec 2012 16:02:40 -0700
Hi Joe,
I think you should be able to log the qualifier in your d2w app if you add this to your Application class
@Override
public void didFinishLaunching() {
super.didFinishLaunching();
ERXEC._factory().setDefaultEditingContextDelegate(new ERXDefaultEditingContextDelegate() {
public NSArray editingContextShouldFetchObjects(EOEditingContext ec, EOFetchSpecification fs) {
EOQualifier q = fs.qualifier();
log.info(q);
return null;
}
});
}
Ramsey
On Dec 14, 2012, at 3:27 PM, Joe Kramer wrote:
> Hi all,
>
> I have a pretty simple model with a person object that has a to-many relationship to addresses. There are about ~30,000 people in the DB. I am trying to find people who have addresses that have a specific postal code.
>
> My first attempt at writing the qualifier is horribly slow:
>
> EOQualifier zipQual = ERXQ.startsWith(Person.ADDRESSES.append(Address.POSTAL_CODE).key(), _zipCode);
>
> I created a D2W project and it can do something similar very in a very performant fashion right out of the box, so I know there isn't a problem with my DB (indexes, etc.). I am trying to find what the qualifier is that the query page uses. I can see that the SQL generated is quite a bit different than my qualifier. My qualifier causes a SELECT to happen on every row, whereas the D2W qualifier only runs a single SELECT.
>
> Can anyone help me with a more efficient qualifier to find people across the to-many relationship? Or can someone point me to the D2W code that builds the qualifier on the query page?
>
> Thanks,
>
> Joe
> _______________________________________________
> 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
_______________________________________________
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