我當前的代碼提取物
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
對象,但我對如何提取對象內部的DATAS困惑內的值。
比方說,我想從resultQuery
對象
哦!我很愚蠢的使用結果作爲一個對象。感謝一堆! – galao 2013-02-13 07:49:15