You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Mike Kienenberger <mk...@gmail.com> on 2006/08/23 21:35:51 UTC

Detecting when outer joins are needed [Was: Cayenne does not throw an exception when an outer join is attempted]

Here's where I'm finding that I need outer joins:

1) If two qualifiers for a non-mandatory relationship path are or'd
together.   This is also what Øyvind Harboe reported.   It may be that
the non-mandatory part is irrelevent.

2) If using noMatchExp on a non-null value for a non-mandatory
relationship path.


On 8/17/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> > Would it make sense for Cayenne to throw an exception when an outer
> > join is attempted?
>
> Could you be more specific on when it should detect that? IIRC there
> were some discussions on that in the past. You provide no references
> though.
>
> Also there is an effort underway to support outer joins (we will have
> to do it in 3.0 anyways as the goal is to be compatible with the JPA
> spec that requires them):
>
> http://objectstyle.org/cayenne/lists/cayenne-devel/2006/08/0106.html
>
> Andrus
>
> On Aug 17, 2006, at 3:24 AM, Øyvind Harboe wrote:
> > Outer joins are not supported, I know.
> >
> > Meanwhile I miss being *told* when I'm attempting an outer join,
> > minimally runtime.
> >
> > One of the reasons I'm using Cayenne is that I don't want to think
> > about SQL, so I don't. It hurts even thinking about thinking about how
> > Cayenne Expressions turn into SQL statements :-)
> >
> > Would it make sense for Cayenne to throw an exception when an outer
> > join is attempted?
> >
> > Could I attempt to implement such a detection in Cayenne myself and
> > submit a patch or is it fiendishly difficult?

Re: Detecting when outer joins are needed

Posted by Øyvind Harboe <oy...@zylin.com>.
> > Also, how do I know that I've got the complete list of gotchas?
>
> How do you know that we have it handled correctly in Cayenne ? ;-)
> That's my point exactly - this requires analysis - Cayenne can't do
> it automagically.

I see. Documentation here (even more so than usually) will be greatly
appreciated.


-- 
Øyvind Harboe
http://www.zylin.com

Re: Detecting when outer joins are needed

Posted by Andrus Adamchik <an...@objectstyle.org>.
-1.

My argument still stands - unless a user tells us what (s)he wants to  
do, there is no good way to guess it. Ok, we've even identified a few  
specific cases. But we still can't guess it in a general case.  
Changing the algorithm without understanding it is asking for trouble.

> Also, how do I know that I've got the complete list of gotchas?

How do you know that we have it handled correctly in Cayenne ? ;-)  
That's my point exactly - this requires analysis - Cayenne can't do  
it automagically.

Andrus


On Aug 28, 2006, at 9:54 AM, Øyvind Harboe wrote:

> On 8/25/06, Andrus Adamchik <an...@objectstyle.org> wrote:
>>
>> On Aug 23, 2006, at 11:35 PM, Mike Kienenberger wrote:
>>
>> > Here's where I'm finding that I need outer joins:
>> >
>> > 1) If two qualifiers for a non-mandatory relationship path are or'd
>> > together.   This is also what Øyvind Harboe reported.   It may  
>> be that
>> > the non-mandatory part is irrelevent.
>> >
>> > 2) If using noMatchExp on a non-null value for a non-mandatory
>> > relationship path.
>>
>> Thanks Mike - that makes sense. I think "non mandatory" part is
>> relevant. Not sure that we need to catch it though. IMO this should
>> be left as an exercise to the user.
>
> I could really do with having this exercise clearly formulated in  
> doc/wiki...
>
> I have a hard time explaining my peers what precisely it is that they
> should be looking for.
>
> Also, how do I know that I've got the complete list of gotchas?
>
> Is it in theory possible to detect this during runtime?
>
> It would be nice to be able to add some runtime checks that generated
> expressions aren't running into this problem.
>
> -- 
> Øyvind Harboe
> http://www.zylin.com
>


Re: Detecting when outer joins are needed [Was: Cayenne does not throw an exception when an outer join is attempted]

Posted by Øyvind Harboe <oy...@zylin.com>.
On 8/25/06, Andrus Adamchik <an...@objectstyle.org> wrote:
>
> On Aug 23, 2006, at 11:35 PM, Mike Kienenberger wrote:
>
> > Here's where I'm finding that I need outer joins:
> >
> > 1) If two qualifiers for a non-mandatory relationship path are or'd
> > together.   This is also what Øyvind Harboe reported.   It may be that
> > the non-mandatory part is irrelevent.
> >
> > 2) If using noMatchExp on a non-null value for a non-mandatory
> > relationship path.
>
> Thanks Mike - that makes sense. I think "non mandatory" part is
> relevant. Not sure that we need to catch it though. IMO this should
> be left as an exercise to the user.

I could really do with having this exercise clearly formulated in doc/wiki...

I have a hard time explaining my peers what precisely it is that they
should be looking for.

Also, how do I know that I've got the complete list of gotchas?

Is it in theory possible to detect this during runtime?

It would be nice to be able to add some runtime checks that generated
expressions aren't running into this problem.

-- 
Øyvind Harboe
http://www.zylin.com

Re: Detecting when outer joins are needed [Was: Cayenne does not throw an exception when an outer join is attempted]

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Aug 23, 2006, at 11:35 PM, Mike Kienenberger wrote:

> Here's where I'm finding that I need outer joins:
>
> 1) If two qualifiers for a non-mandatory relationship path are or'd
> together.   This is also what Øyvind Harboe reported.   It may be that
> the non-mandatory part is irrelevent.
>
> 2) If using noMatchExp on a non-null value for a non-mandatory
> relationship path.

Thanks Mike - that makes sense. I think "non mandatory" part is  
relevant. Not sure that we need to catch it though. IMO this should  
be left as an exercise to the user.

Andrus