You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given some Java code like:
Criteria criteria = Criteria.forClass(Projet.class);
criteria.add(Restrictions.eq("campagne.id", idCampagne));
DAO.findByCriteria(criteria);
Using EclipseLink JPA provider (I updated the pom.xml), I get this error:
java.lang.IllegalArgumentException: An exception occurred while creating a
query in EntityManager:
Exception Description: Syntax error parsing the query [select this from Projet
as this where this.campagne.id=?], line 0, column -1: unexpected end of query.
Internal Exception: NoViableAltException(-1!=[792:1:
comparisonExpressionRightOperand returns [Object node] : (n=
arithmeticExpression | n= nonArithmeticScalarExpression | n= anyOrAllExpression
);])
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1373)
at com.szczytowski.genericdao.criteria.Criteria.prepareQuery(Criteria.java:333)
at com.szczytowski.genericdao.criteria.Criteria.list(Criteria.java:236)
at com.szczytowski.genericdao.impl.GenericDao.findByCriteria(GenericDao.java:319)
[...]
It looks like "select this from Projet as this where this.campagne.id=?" is not
a valid JPQL query.
AFAIK numbered parameters must be specified with an index, e.g.:
"select this from Projet as this where this.campagne.id=?1"
Whereas Hibernate HQL doesn't need this index, that's why included tests for
criteria succeed.
Original issue reported on code.google.com by [email protected] on 27 Jan 2011 at 11:24
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 27 Jan 2011 at 11:24The text was updated successfully, but these errors were encountered: