Hi I have a Named Query
@NamedQuery(name = \"StudyplanCategory.findByStatusAndLimit\",
query = \"SELECT s FROM StudyplanCategory s WHERE
As @DataNucleus said, LIMIT is not a valid keyword in JPQL. That's not the way to specify how many rows to return. This is how you do it:
@NamedQuery(name = "StudyplanCategory.findByStatusAndLimit",
query = "SELECT s FROM StudyplanCategory s WHERE
s.status =:status")
And this would be the code to call the named query:
Query query = entityManager.createNamedQuery("StudyplanCategory.findByStatusAndLimit");
int end=(start*pageNumber);
query.setParameter("status", status);
query.setFirstResult(start);
query.setMaxResults(end - start);
return (List) query.getResultList();