You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (Jira)" <ji...@apache.org> on 2026/09/20 16:47:00 UTC

[jira] [Closed] (CAY-3033) Selects with subqueries produce conflicting cache keys

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

Andrus Adamchik closed CAY-3033.
--------------------------------
    Resolution: Fixed

> Selects with subqueries produce conflicting cache keys
> ------------------------------------------------------
>
>                 Key: CAY-3033
>                 URL: https://issues.apache.org/jira/browse/CAY-3033
>             Project: Cayenne
>          Issue Type: Bug
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>            Priority: Minor
>             Fix For: 5.0-M4
>
>
> Selects with subqueries produce conflicting cache keys and can return the wrong cache results. 
> {noformat}
> // artist1 has a painting priced 10, artist2 has a painting priced 1000
> static ObjectSelect<Artist> artistsWithPaintingsOver(int price) {
>       return ObjectSelect.query(Artist.class)
>               .where(ExpressionFactory.exists(ObjectSelect.query(Painting.class)
>                       .where(Painting.TO_ARTIST.eq(Artist.SELF.enclosing()))
>                       .and(ExpressionFactory.greaterExp("estimatedPrice", price))));
> }
>  // 2 artists, correct
> artistsWithPaintingsOver(5).localCache().select(context);   
> // 2 artists, WRONG: no SQL is run, the first result is returned
> artistsWithPaintingsOver(500).localCache().select(context);  
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)