Suqueries in select clause with JPA
问题 I need to execute a subquery in a select clause with Apache Openjpa 2. Does JPA support subqueries in SELECT clause? My Query is something like this: SELECT t.date, t.value, (SELECT COUNT(DISTINCT t2.value2) FROM table t2 WHERE t2.date = t.date) FROM table t WHERE ... When I execute my query, I get a class cast exception: Exception in thread "main" <openjpa-2.1.1-SNAPSHOT-r422266:1141200 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: at org.apache.openjpa.kernel