I have done more experimentation and found that my pseudo ODMG was actually quite close. The following ODMG query runs:

select person from " + Person.class.getName() +
" where roles.project.title != XXX"

Unfortunately, this only returns persons that have at least one role. It doesn't return all the persons that have no roles. So I still don't quite know the answer to my original question.

And this brings up another one: How would one formulate the query to return all persons that have no roles?

As an incentive to get answers to these query formulation questions, I promise to write up a FAQ on what I learn.

Will


Phil Warrick wrote:
Hi all,

Does anyone have an answer for Will? I've often asked myself this same question. Or more generally how to deal with traversing towards the 'many' side of an association (1:m or n:m) in a query.

Thanks,

Phil

Will Jaynes wrote:

I'm wondering how to formulate a query. I'm sure this is s FAQ, but I can't find the answer...

Looking at the "Mapping M:N associations" section of the "Advanced O/R" doc, I have a situation which is analogous to the Person, Project, PersonProject example of decomposition into two 1:N associations.

I'd like to retrieve all Person objects that do not have a Project with title = "XXX". This seems kind of complicated since, if I were to write it in psuedo ODMG I would write

select person from Person.class.getName()
where roles[*].project.title != "XXX"

How would this really be formulated in ODMG?
How would this be formulated in just the PB?

Thanks, Will


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to