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: Fri, 26 Oct 2007 13:51:05 -0700
On Oct 26, 2007, at 11:32 AM, James Cicenia wrote:
Well actually I didn't.. I just brought in the source and compiled it.
And you expected it to work? :-) See
com.houdah.webobjects.eoaccess.PrincipalClass for why it does not.
By the way I also tried Lachlan's version and that didn't seem to
generate a real IN or CONTAINS clause in the sql
so the it always returns 0 rows.
Here is the generated sql:
I would not be surprised to see that that in many (most?) cases
QualifierOperatorContains does not generate correct SQL for complex
queries for to-many relationships.
Chuck
FROM portfolio_project t0, portfolio_metric_list_portfolio_project T1
WHERE
(
(
(T1.portfolio_metric_id = ? OR T1.portfolio_metric_id = ?) AND
(T1.portfolio_metric_id = ? OR T1.portfolio_metric_id = ?)
)
AND
(t0.lifecycle_state <> ? AND (t0.lifecycle_state <> ? AND
t0.portfolio_id = ?))
)
AND
t0.row_id = T1.portfolio_project_id
That first AND will always evaluate as false.
Thanks
James
On Oct 26, 2007, at 12:28 PM, Chuck Hill wrote:
Without information on how you are using it and the model, you
leave us guessing.
Well, as I am left guessing, I guess that the framework is not
getting initialized correctly. Did you add the framework like a
normal WO framework?
Chuck
On Oct 26, 2007, at 7:16 AM, James Cicenia wrote:
Ok -
I tried the ExistsInRelationshipQualifier but I get this error:
(class
com.houdah.webobjects.eocontrol.ExistsInRelationshipQualifier
(does not implement EOQualifierSQLGeneration
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._schemaBasedQualifierWithRootEntity
(EOQualifierSQLGeneration.java:163)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$_AndQualifierSupport.schemaBasedQualifierWithRootEntity
(EOQualifierSQLGeneration.java:502)
at com.webobjects.eoaccess.EOQualifierSQLGeneration
$Support._schemaBasedQualifierWithRootEntity
(EOQualifierSQLGeneration.java:165)
Thanks
James
On Oct 25, 2007, at 9:47 PM, Chuck Hill wrote:
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:
40jimijon.com
This email sent to email@hidden
--
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
--
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