Reputation:
Considering following correct query
select _.* from _misc._lang__ _ where _.id > 10 order by _.id asc limit 1 offset 0
Now I tried to make the JPQL query like this
select l from _misc._lang__ l where l.id > :arg order by l.id asc limit 1 offset 0
And the error(EclipseLink)
The ORDER BY clause has 'l.id ASC ' and 'limit ' that are not separated by a comma.
It seems eclipse link got the limit
as column name rather than the keyword, now how can I fix it?
Thanks!
Upvotes: 0
Views: 1189
Reputation: 1490
"limit" is not reconized. You can use yourQuery.setMaxresults
method instead like so :
result=em.createQuery("select l.* from _misc._lang__ l where l.id > :arg order by l.id asc").setParameter("arg", yourArg).setMaxResults(2).getResultList()
Upvotes: 4