当我在 JPA 中编码时,我发现这个错误说“方法 getLong() 未定义类型查询”请帮助我解决这个问题。
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;}