Pregunta

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!

¿Fue útil?

Solución

"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()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top