There's a patch somewhere that adds left outer joins to 2.0, probably
in the jira issue for outer joins. It's used in one of my production
apps. But it's probably safer to upgrade to 3.0
On Sun, Jan 10, 2010 at 7:30 AM, Andrus Adamchik <andru..bjectstyle.org> wrote:
> If I understand correctly, the goal is to match artists that must have
> painting that are ALL with the same color. So I think the second OR would
> match artists that have SOME painting of matching color, and some of a
> different color.
>
> But I guess the important thing here is that Andrey and me showed 2 new
> capabilities of Cayenne 3.0 that would help with a number of non-trivial
> queries.
>
> Andrus
>
> On Jan 10, 2010, at 2:08 PM, Andrey Razumovsky wrote:
>
>> Or you can use left joins:
>> ExpressionFactory.matchExp("paintingsArray+.color",
>> null).orExp(ExpressionFactory.matchExp("paintingsArray+.color", blue));
>>
>> 2010/1/10 Andrus Adamchik <andru..bjectstyle.org>
>>
>>> This requires Cayenne 3.0 and EJBQLQuery with subquery. Something like
>>> this
>>> might work:
>>>
>>> new EJBQLQuery(
>>> "SELECT a FROM Artist a " +
>>> "WHERE NOT EXISTS " +
>>> "(SELECT p FROM Painting p WHERE p.color <> 'XYZ')";
>>>
>>> Andrus
>>>
>>>
>>> On Jan 7, 2010, at 2:32 AM, Mark Fraser wrote:
>>>
>>> Suppose I have an Artists table and a Paintings table with the usual
>>> setup
>>>>
>>>> of the Artist class having a PAINTINGS_ARRAY property. Suppose further
>>>> that
>>>> the painting has a "color" property that can be a string or null.
>>>>
>>>> How would I build an Expression such that I get back the Artists that
>>>> have
>>>> either no paintings or only paintings with a specific color value (or a
>>>> null
>>>> color value)?
>>>>
>>>> I am using Cayenne 2.0.4 in case that matters.
>>>>
>>>> TIA
>>>>
>>>
>>>
>>
>>
>> --
>> Andrey
>
>
This archive was generated by hypermail 2.0.0 : Mon Jan 11 2010 - 08:04:08 EST