And I called this name query in my DAO class:
But as I ran my web application, it got this kind of error message (no matter the name of query or the sql statement is corrent):
java.lang.IllegalArgumentException: NamedQuery of name: jobDutyJobTitle.findByJobDuty not found. at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:422) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:136) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:464) at com.htc.hr.dao.JobDutyJobTitleDAO.findByJobDuty(JobDutyJobTitleDAO.java:41) at com.htc.hr.controller.JobDutyController.showJobDutyJobTitle(JobDutyController.java:47)
The root cause is: I forgot to add this enity class declaration into persistence.xml