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
4 comments:
Ran into the same issue... Your post was very straightforward and useful! Thanks!
Precise.Thankyou!
The class (or classes) should be specified outside the properties tag.
Muito bom seu Post. Resolveu meu problema de imediato!
Brilliant! Exactly what I needed to know.. Thanks!
Post a Comment