[ https://issues.apache.org/jira/browse/CAY-2468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nikita Timofeev closed CAY-2468. -------------------------------- Resolution: Fixed https://github.com/apache/cayenne/commit/60c55667568bffaf92f738289a6ca7b2f2b2bc68 > Support subqueries in Expression API > ------------------------------------ > > Key: CAY-2468 > URL: https://issues.apache.org/jira/browse/CAY-2468 > Project: Cayenne > Issue Type: Task > Components: Core Library, Database integration > Reporter: Nikita Timofeev > Assignee: Nikita Timofeev > Priority: Major > Fix For: 4.2.M1 > > > Currently there is no way to use subqueries in {{SelectQuery}} or > {{ObjectSelect}}. > So we need a way to do so in {{Expression}} API. > Simple version can be implemented like this: > {code:java} > ObjectSelect<Painting> subquery = ObjectSelect.query(...); > long count = ObjectSelect.query(Artist.class) > .where(ExpressionFactory.exists(subquery)) > .selectCount(context); > {code} > Also we need a way to use expressions from top level query in a subquery. > Maybe it can be new expression (like {{Artist.ARTIST_NAME.enclosing()}}) > In a first iteration this should support {{EXISTS}} and {{IN}} subqueries. -- This message was sent by Atlassian JIRA (v7.6.3#76005)