Hi,
I'm still trying to figure out how to query for an object that has several specified matches in it's collection object.
So, say I have a Feature which has multiple Settings. I simply want to find the Features where the Settings are equals to "A", "B", "C" and "D".
I can do this with multiple joins on Settings, but doesn't seem like the right way to go when you're looking for upto 7 Settings, something like:
SELET f FROM
Feature f INNER JOIN f.settings s1
INNER JOIN f.settings s2
INNER JOIN s.settings s3
INNER JOIN s.settings s4
WHERE s1.value = "A" AND
s2.value = "B" AND
s3.value = "C" AND
s4.value = "D".
Surely there's a better way? We have the added complication that we have a Printer object that has Feature collection which have Settings collection, and we have to search for Feature-Setting combinations. Thus we end up with a HUGE query of joins.
cheers,
David
|