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/07/18 14:23:00 UTC

[jira] [Updated] (CAY-2332) Property API: unable to use eq() and in() methods for toMany relationships

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

Nikita Timofeev updated CAY-2332:
---------------------------------
    Description: 
Following code won't compile as {{eq()}} (as well as {{in()}}) method require {{List<Paintings>}} or other Property<> in this case, but everything else down the stack will correctly translate and execute this query and return correct result (I've checked this by simply allowing {{Object}} as argument in {{eq()}})
{code}                
    Painting painting = ObjectSelect.query(Painting.class).selectFirst(context);
    Artist artist = ObjectSelect.query(Artist.class)
            .where(Artist.PAINTING_ARRAY.eq(painting))
            .selectFirst(context);
{code}

Generated SQL:
{code:sql}
SELECT DISTINCT t0.ARTIST_NAME, t0.DATE_OF_BIRTH, t0.ARTIST_ID 
FROM ARTIST t0 
JOIN PAINTING t1 ON (t0.ARTIST_ID = t1.ARTIST_ID) 
WHERE t1.PAINTING_ID = ? 
LIMIT 1 OFFSET 0 
[bind: 1->PAINTING_ID:1]
{code}

  was:
Following code won't compile as {{eq()}} (as well as {{in()}}) method require {{List<Paintings>}} or other Property<> in this case, but everything else down the stack will correctly translate and execute this query and return correct result (I've checked this by simply allowing {{Object}} as argument in {{eq()}})
{code}                
    Painting painting = ObjectSelect.query(Painting.class).selectFirst(context);
    Artist artist = ObjectSelect.query(Artist.class)
            .where(Artist.PAINTING_ARRAY.eq(painting))
            .selectFirst(context);
{code}


> Property API: unable to use eq() and in() methods for toMany relationships
> --------------------------------------------------------------------------
>
>                 Key: CAY-2332
>                 URL: https://issues.apache.org/jira/browse/CAY-2332
>             Project: Cayenne
>          Issue Type: Bug
>            Reporter: Nikita Timofeev
>
> Following code won't compile as {{eq()}} (as well as {{in()}}) method require {{List<Paintings>}} or other Property<> in this case, but everything else down the stack will correctly translate and execute this query and return correct result (I've checked this by simply allowing {{Object}} as argument in {{eq()}})
> {code}                
>     Painting painting = ObjectSelect.query(Painting.class).selectFirst(context);
>     Artist artist = ObjectSelect.query(Artist.class)
>             .where(Artist.PAINTING_ARRAY.eq(painting))
>             .selectFirst(context);
> {code}
> Generated SQL:
> {code:sql}
> SELECT DISTINCT t0.ARTIST_NAME, t0.DATE_OF_BIRTH, t0.ARTIST_ID 
> FROM ARTIST t0 
> JOIN PAINTING t1 ON (t0.ARTIST_ID = t1.ARTIST_ID) 
> WHERE t1.PAINTING_ID = ? 
> LIMIT 1 OFFSET 0 
> [bind: 1->PAINTING_ID:1]
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)