You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by "Ari Maniatis (JIRA)" <de...@cayenne.apache.org> on 2007/12/03 09:12:44 UTC

[JIRA] Created: (CAY-928) Ordering across relationship should use inner join

Ordering across relationship should use inner join
--------------------------------------------------

                 Key: CAY-928
                 URL: https://issues.apache.org/cayenne/browse/CAY-928
             Project: Cayenne
          Issue Type: Bug
          Components: Cayenne Core Library
            Reporter: Ari Maniatis
            Assignee: Andrus Adamchik
            Priority: Critical


When ordering across a relationship like this:

SelectQuery qual = new SelectQuery(Painting.class);
qual.addOrdering(new Ordering(Painting.ARTIST_PROPERTY+"."+Artist.NAME_PROPERTY, true, true));

the SQL looks like this:

SELECT t0.id FROM Painting t0, Artist t1 WHERE t0.artistId = t1.id  ORDER BY t1.name

but it should be like this:

SELECT t0.id FROM Painting t0 LEFT JOIN Artist t1 ON t0.artistId = t1.id  ORDER BY t1.name

What this means is that at the moment Cayenne will exclude from this query all paintings with no related artist.

Regardless of how one thinks NULLs should be sorted in this relationship, the addition of a new Ordering in Cayenne shouldn't change the number of records returned from the SelectQuery.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[JIRA] Commented: (CAY-928) Ordering across relationship should use left join

Posted by "Andrus Adamchik (JIRA)" <de...@cayenne.apache.org>.
    [ https://issues.apache.org/cayenne/browse/CAY-928?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12613 ] 

Andrus Adamchik commented on CAY-928:
-------------------------------------

This can only be implemented when we change a SelectQuery translator to use JOIN syntax (instead key1 = key2) ... I think we should do that at some point.


> Ordering across relationship should use left join
> -------------------------------------------------
>
>                 Key: CAY-928
>                 URL: https://issues.apache.org/cayenne/browse/CAY-928
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>            Reporter: Ari Maniatis
>            Assignee: Andrus Adamchik
>            Priority: Critical
>
> When ordering across a relationship like this:
> SelectQuery qual = new SelectQuery(Painting.class);
> qual.addOrdering(new Ordering(Painting.ARTIST_PROPERTY+"."+Artist.NAME_PROPERTY, true, true));
> the SQL looks like this:
> SELECT t0.id FROM Painting t0, Artist t1 WHERE t0.artistId = t1.id  ORDER BY t1.name
> but it should be like this:
> SELECT t0.id FROM Painting t0 LEFT JOIN Artist t1 ON t0.artistId = t1.id  ORDER BY t1.name
> What this means is that at the moment Cayenne will exclude from this query all paintings with no related artist.
> Regardless of how one thinks NULLs should be sorted in this relationship, the addition of a new Ordering in Cayenne shouldn't change the number of records returned from the SelectQuery.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (CAY-928) Ordering across relationship should use left join

Posted by "Andrus Adamchik (JIRA)" <de...@cayenne.apache.org>.
     [ https://issues.apache.org/cayenne/browse/CAY-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-928.
-------------------------------

    Resolution: Fixed

CAY-929 fix addresses this issue too... The way join semantics now works is this: there is no implicit rule for OUTER joins, it is all encoded in the path. E.g.:

SelectQuery query = new SelectQuery(Painting.class);
query.addOrdering("toArtist+.artistName", Ordering.DESC);

(Notice plus sign indicating OUTER join after "toArtist").

> Ordering across relationship should use left join
> -------------------------------------------------
>
>                 Key: CAY-928
>                 URL: https://issues.apache.org/cayenne/browse/CAY-928
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>            Reporter: Ari Maniatis
>            Assignee: Andrus Adamchik
>            Priority: Critical
>
> When ordering across a relationship like this:
> SelectQuery qual = new SelectQuery(Painting.class);
> qual.addOrdering(new Ordering(Painting.ARTIST_PROPERTY+"."+Artist.NAME_PROPERTY, true, true));
> the SQL looks like this:
> SELECT t0.id FROM Painting t0, Artist t1 WHERE t0.artistId = t1.id  ORDER BY t1.name
> but it should be like this:
> SELECT t0.id FROM Painting t0 LEFT JOIN Artist t1 ON t0.artistId = t1.id  ORDER BY t1.name
> What this means is that at the moment Cayenne will exclude from this query all paintings with no related artist.
> Regardless of how one thinks NULLs should be sorted in this relationship, the addition of a new Ordering in Cayenne shouldn't change the number of records returned from the SelectQuery.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[JIRA] Updated: (CAY-928) Ordering across relationship should use left join

Posted by "Ari Maniatis (JIRA)" <de...@cayenne.apache.org>.
     [ https://issues.apache.org/cayenne/browse/CAY-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ari Maniatis updated CAY-928:
-----------------------------

    Summary: Ordering across relationship should use left join  (was: Ordering across relationship should use inner join)

> Ordering across relationship should use left join
> -------------------------------------------------
>
>                 Key: CAY-928
>                 URL: https://issues.apache.org/cayenne/browse/CAY-928
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>            Reporter: Ari Maniatis
>            Assignee: Andrus Adamchik
>            Priority: Critical
>
> When ordering across a relationship like this:
> SelectQuery qual = new SelectQuery(Painting.class);
> qual.addOrdering(new Ordering(Painting.ARTIST_PROPERTY+"."+Artist.NAME_PROPERTY, true, true));
> the SQL looks like this:
> SELECT t0.id FROM Painting t0, Artist t1 WHERE t0.artistId = t1.id  ORDER BY t1.name
> but it should be like this:
> SELECT t0.id FROM Painting t0 LEFT JOIN Artist t1 ON t0.artistId = t1.id  ORDER BY t1.name
> What this means is that at the moment Cayenne will exclude from this query all paintings with no related artist.
> Regardless of how one thinks NULLs should be sorted in this relationship, the addition of a new Ordering in Cayenne shouldn't change the number of records returned from the SelectQuery.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.