cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Koyro (JIRA)" <>
Subject [jira] [Created] (CAY-2032) SelectAction: DistinctResultIterator ignores flattened relationships
Date Thu, 01 Oct 2015 07:18:04 GMT
Denis Koyro created CAY-2032:

             Summary: SelectAction: DistinctResultIterator ignores flattened relationships
                 Key: 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

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.*, FROM user t0 
JOIN user_has_team t1 ON ( = t1.user_id) 
JOIN team t2 ON (t1.team_id =;
3 records are resulted from the 2nd query execution. The records are differs by "" 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

View raw message