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

Nikita Timofeev reassigned CAY-2332:
------------------------------------

    Assignee: Nikita Timofeev

> 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
>            Assignee: Nikita Timofeev
>            Priority: Major
>             Fix For: 4.2.M1
>
>
> 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}
> Workaround can be parsing expression from string:
> {{.where(ExpressionFactory.exp("paintingArray = $p", painting))}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to