Click here to Skip to main content
15,889,651 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i found exception while creating a named query.its say NamedQuery:odcall.incoming not found. odcall.incoming is my entity name.

What I have tried:

Java
@NamedQuery(name="odcalls.call", 
             query="SELECT C.count(id)," 
                        + "C.date(CalllocalTime)," 
                        + "C.hour(CalllocalTime) from ODCalls as C " 
                  + "where "
                  + " C.date(CallLocalTime) between date_sub(curdate(), Interval 12 month) and date_sub(curdate(),Interval 1 day) : Date " 
                  + " and C.FirstQueue != 0 : String " 
                  + " and C.Calltype in (1) : int " 
                  + "GROUP BY C.hour(CallLocalTime), C.date(CallLocalTime)")
This is my Dao class
public class ODCallsImpl implements IDao <ODCalls> {
         EntityManager em = EntitiyManagerUtil.getInstance().getEntityManager();
         private List<ODCalls> calls = new ArrayList<ODCalls>();

         @SuppressWarnings("unchecked"  @Override
         @PersistenceContext
         public List<ODCalls> getAll() {
              calls = em.createNamedQuery(" odcalls.incoming";,ODCalls.class).getResultList();
              em.close();
              return calls;
         }
Posted
Updated 28-Apr-16 0:33am
v2
Comments
Shubhashish_Mandal 28-Apr-16 6:39am    
Lots of typo. In @namedQuery, you have defined a query named as "odcalls.call". And in the application you have called "odcalls.incoming". Is there any other namedquery defined as "odcalls.incoming". I can seen extra spaces in named query.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900