Re: many-to-many query question
Re: many-to-many query question
- Subject: Re: many-to-many query question
- From: Chuck Hill <email@hidden>
- Date: Thu, 25 Oct 2007 19:47:45 -0700
On Oct 25, 2007, at 6:29 PM, Lachlan Deck wrote:
On 26/10/2007, at 10:40 AM, James Cicenia wrote:
I have a many-to-many relationship as such:
Portfolio --->>MetricGroups--->>MetricItems<----project_item----
>Project
How I can create a query where
project can have ( Items(a) OR Items(b) ) AND (Items(c))
Something like this...
NSMutableArray itemsAQuals = new NSMutableArray();
String keyPathToA = "blah.blah";
for ( Item a : itemsA ) {
itemsAQuals.addObject( new EOKeyValueQualifier( keyPathToA,
EOQualifier.QualifierOperatorContains, a ) );
}
etc...
EOQualifier q = new EOAndQualifier( new NSArray( new Object[] {
new EOOrQualifier(new NSArray(new Object[] {
new EOAndQualifier( itemsAQuals ),
new EOAndQualifier( itemsBQuals )
} ) ),
new EOAndQualifier( itemsCQuals )
} ) );
That will work in memory, but EOQualifier.QualifierOperatorContains
won't generate correct SQL for most databases. Do you use one that
this works on?
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden