cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugi Thordarson <h...@karlmenn.is>
Subject Re: Expression to look for objects with an empty to-many relationship?
Date Tue, 28 Jul 2015 08:05:41 GMT
> It''s been a long time since I've done this (years, Cayenne 1.2 with
> outer join support), but I seem to recall being about to do this with
> a ExpressionFactory.matchExp(path, null).

Well, wouldn’t you know — that actually worked! Although the SQL it generates is a little
wonky. It attempts to join on a destination key of null (which of course never exists, so
it always returns empty relationships). Haven’t seen it before but perhaps it’s perfectly
legal.


> Like Andrus said, you might need to add a "+" in there to force an outer join.
> 
> Sorry I can't be of more help.
> 
> It would be great if you submitted an expression type that supported
> this trivially.

Let’s hope it ends up that way :).

- hugi



> On Fri, Jul 24, 2015 at 12:56 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
>> Indeed :). I’ve been looking at the Expression classes for a while now and they
look a little daunting. Any recommendations on where to start? Is there a developer guide
or an annotated example implementation somewhere?
>> 
>> - hugi
>> 
>> 
>> 
>>> On 24. júl. 2015, at 15:59, Andrus Adamchik <andrus@objectstyle.org> wrote:
>>> 
>>> Classic open source - "scratch your own itch" :)
>>> 
>>> 
>>>> On Jul 24, 2015, at 6:54 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
>>>> 
>>>> Thanks Andrus, we’ll revert to EJBQL for now.
>>>> 
>>>> Looks like an excellent opportunity to try and implement my first Expression
class :)
>>>> 
>>>> - hugi
>>>> 
>>>> 
>>>> 
>>>>> On 24. júl. 2015, at 15:36, Andrus Adamchik <andrus@objectstyle.org>
wrote:
>>>>> 
>>>>> We should add it. For now OUTER JOIN should do the trick:
>>>>> 
>>>>> "a.paintingArray+ = null"
>>>>> 
>>>>> Also EJBQL syntax supports "IS [NOT] EMPTY" :
>>>>> 
>>>>> "SELECT a FROM Artist a WHERE a.paintingArray IS EMPTY"
>>>>> 
>>>>> Andrus
>>>>> 
>>>>>> On Jul 24, 2015, at 5:51 PM, Hugi Thordarson <hugi@karlmenn.is>
wrote:
>>>>>> 
>>>>>> Hi all.
>>>>>> Does Cayenne have an Expression class that allows searching for objects
with an empty to-many relationships? If not, any pointers towards a sensible approach?
>>>>>> 
>>>>>> Cheers,
>>>>>> - hugi
>>>>>> 
>>>>>> // Hugi Thordarson
>>>>>> // http://www.loftfar.is/ <http://www.loftfar.is/>
>>>>>> // s. 895-6688
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>> 


Mime
View raw message