嗨,我有一个命名查询
@NamedQuery(name = "StudyplanCategory.findByStatusAndLimit",
query = "SELECT s FROM StudyplanCategory s WHERE
s.status =:status LIMIT s.start=:start,s.end=end")
我想像这样设置限制:
@NamedQuery(name = "StudyplanCategory.findByStatusAndLimit",
query = "SELECT s FROM StudyplanCategory s WHERE
s.status =:status LIMIT s.start=:start,s.end=end")
但这在服务器启动时显示错误。我正在使用以下代码在 DAO 类中调用查询:
Query query = entityManager.createNamedQuery("StudyplanCategory.findByStatusAndLimit");
int end=(start*pageNumber);
query.setParameter("status", status);
query.setParameter("start", start);
query.setParameter("end", end);
return (List<StudyplanCategory>) query.getResultList();
需要设置开始和结束参数。请帮忙。