I noticed in doing some testing with OpenJPA that the OpenJPA jjt grammar file is not quite in sync with JPA spec. For instance
" select NEW .... " should only be valid in top level query, not subquery. " ... having max( e.salary ) ..." gives syntax error. Expressions in having clause should allow aggregate functions. " select e from Employee e where exists ( select p from in(e.projects) p ) " is valid EJB QL but gives syntax error. I have also gotten bad sql generated if a subquery contains another subquery. Is anyone else aware of these or should I open up bugs.