EclipseLink Query - Select count(*) from student s not working

I think the exception is rather self explanatory. JPQL parser treats (*) as arithmetic operator thus it expects two operands within parentheses to perform multiplication.

In order to make query string work you would need to add path expressions that refer to student's state fields, i.e.

-- dummy example
SELECT COUNT(s.age * s.height) FROM Student s

If you are interested with EclipseLink's implementation you can go deeper and take a closer look at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate method where grammatical and semantic validation starts.


Try using select count(s) from Student s.