我当前的代码
Object resultQuery;
EntityManagerFactory emf = Persistence.createEntityManagerFactory("TESTPU");
EntityManager em = emf.createEntityManager();
TypedQuery<Account> tp = em.createQuery("SELECT a FROM Account a WHERE a.email = :email AND a.pwd = :pwd AND a.role = 'admin'", Account.class);
tp.setParameter("email", this.username);
tp.setParameter("pwd", this.password);
resultQuery = tp.getSingleResult();
结果存储在resultQuery
对象中,但我对如何提取对象内部的数据感到困惑。
假设我想从对象中提取name
帐户表中的列resultQuery