As stated in the JPA 2.1 specification the count function can be applied to an association field in the select clause:
[...] The path expression argument to COUNT may terminate in either a state field or a association field, or the argument to COUNT may be an identification variable. (JSR 338, section 4.8.5)
So I expect such a query to be valid JPQL:
SELECT count(i.courses) FROM Instructor i GROUP BY i
(instructor entity has bidirectional one-to-many relationship to course entity)
Jet if i try to execute the statement on Hibernate (4.3.11) as a JPA provider it fails (i.e. SQLGrammarException) but EcplipseLink can execute it. So is Hibernate not compliant or did I get it wrong?