考虑遵循正确的查询
select _.* from _misc._lang__ _ where _.id > 10 order by _.id asc limit 1 offset 0
现在我尝试像这样进行JPQL查询
select l from _misc._lang__ l where l.id > :arg order by l.id asc limit 1 offset 0
错误(EclipseLink)
The ORDER BY clause has 'l.id ASC ' and 'limit ' that are not separated by a comma.
似乎eclipse链接将limit
作为列名而不是关键字,现在我该如何修复呢?
谢谢!
答案 0 :(得分:2)
“限制”无法识别。您可以使用yourQuery.setMaxresults
方法,如下所示:
result=em.createQuery("select l.* from _misc._lang__ l where l.id > :arg order by l.id asc").setParameter("arg", yourArg).setMaxResults(2).getResultList()