0
類型的getLong()方法未定義,我發現此錯誤說「方法getLong()未定義類型Query」,請幫我解決此問題。當我在JPA中進行編碼時,查詢
public long getErrorid(String errDesc)
{long errorid=0;
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("wqs-poc"); System.out.println("EntityManager Factory created successfully !!!");
EntityManager em = entityManagerFactory.createEntityManager();
System.out.println("eNTITYmANAGER CREATED SUCCESSFLLY !!!"); Query query = em.createNativeQuery("SELECT errorid FROM wqsd.error_master WHERE errdsesc = "+errorid); errorid = (long)query.getLong();
System.out.println("errorid= "+errorid);
return errorid;}