3
如何使用條件查詢從表中選擇多個列。準則查詢選擇休眠中的多個列?
Select testid,marks from user where id='uid' and name='uname';
我能夠得到的只有testid但testid沿着我需要標記也誰能修改下面的查詢來獲取兩個testid和標記。
Session ses = sessionFactory.getCurentSession();
Criteria c = ses.createCriteria(user.class);
c.add(Restrictions.eq("id", uid));
c.add(Restrictions.eq("name", uname));
c.setProjection(Pojections.distinct(Projections.property("testid")));