【发布时间】:2014-03-30 18:02:18
【问题描述】:
如何使用条件查询从表中选择多个列。
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")));
【问题讨论】:
标签: spring hibernate criteria hibernate-criteria