Community
Participate
Working Groups
Created attachment 231070 [details] NetBeans project in zip file The following query select new dto.ProductWithFavoriteAttributeDTO(p, f.productId) from Product p left join p.favorites f on f.user = p.user where p.userId = :userId is validated and translated, but the SQL fails on execution as follows: Column 'T2.ID' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. Please refer to the attached test case which is a NetBeans ant project that uses the JavaDB database.
In the SQL it tries to use an unnecessary table join T2. Perhaps this can be removed / replaced with using the foreign key, hopefully making life a bit simpler.
Does this still occur if you set the following persistence unit property: eclipselink.jpql.parser=org.eclipse.persistence.queries.ANTLRQueryBuilder
Yes it still occurs. Just with a different error: Internal Exception: NoViableAltException(80@[()* loopback of 477:9: (node= join )*]).
JOIN ON is only supported in the JPA 2.1 specification (implemented in our upcoming 2.5.0 release. Do you still see the same issue using the latest 2.5.0 milestone?
Sorry I haven't checked that. Could you check it please? I asked myself the question also why the query passes validation while it fails at run time. If JOIN ON is not supported then it should fail validation.
I agree that it should fail validation if it is not supported. I believe we have some support of ON in our 2.4.x release that is beyond what is support in the specification, but the support in the spec likely caused us to solidify the support. We will take a look in the more recent streams when we start to address this bug. In the meantime, if you are stuck, 2.5.0 will ship soon and may be worth trying.
Thanks. I am not stuck perhaps thanks to the 2.4.x support you mention. As a workaround I join on parameter value instead of table join.
Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink