Nikita Timofeev created CAY-2468: ------------------------------------ Summary: 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 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, natural way of doing so is to support it in {{Expression}} API. Simple version can be implemented like this: {code} 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)