0

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!

asked May 1, 2014 at 20:12
2
  • I suggest you learn the syntax of JPQL: it uses class names and not table names, it doesn't use .*, and it doesn't have limit and offset clauses. In short it's a different language from SQL, and you have to learn it. Commented May 1, 2014 at 20:23
  • @JBNizet sorry, typo :D Commented May 1, 2014 at 20:36

1 Answer 1

4

"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()
answered May 1, 2014 at 20:30
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.