You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Nikita Timofeev (JIRA)" <ji...@apache.org> on 2017/02/03 14:34:52 UTC

[jira] [Closed] (CAY-2032) SelectAction: DistinctResultIterator ignores flattened relationships

     [ https://issues.apache.org/jira/browse/CAY-2032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nikita Timofeev closed CAY-2032.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 4.0.M5

https://github.com/apache/cayenne/commit/e3704c2878273d339cb3b792d085a65e1a639ec8

> SelectAction: DistinctResultIterator ignores flattened relationships
> --------------------------------------------------------------------
>
>                 Key: CAY-2032
>                 URL: https://issues.apache.org/jira/browse/CAY-2032
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 4.0.M3
>         Environment: MySQL database
> Cayenne 4.0.M3.debfa94
>            Reporter: Denis Koyro
>            Assignee: Nikita Timofeev
>             Fix For: 4.0.M5
>
>
> Let's take a look at the example: 
> Cayenne model: Team and User entities, many-to-many relationship between them. 
> Data: There are 3 teams and a user, who is linked to all these teams.
> We're trying to fetch Teams and their related Users (via the prefetching) by using any of disjoint semantics (perhaps it doesn't matter what semantic is being used in this case). 
> Thus Cayenne engine performs 2 queries:
> 1. To fetch Team records;
> 2. To fetch User records:
> SELECT t0.*, t2.id FROM user t0 
> JOIN user_has_team t1 ON (t0.id = t1.user_id) 
> JOIN team t2 ON (t1.team_id = t2.id);
> 3 records are resulted from the 2nd query execution. The records are differs by "t2.id" column (it's a Team id), so they are not distinct. 
> And as a result DistinctResultIterator should take this fact into account during processing the results.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)