利用投影可以解决此问题:
1 Criteria criteria=session.createCriteria(User.class);
2 ProjectionList proList = Projections.projectionList();//设置投影集合
3 proList.add(Projections.groupProperty( "userName "));
4 proList.add(Projections.groupProperty( "password "));
5 criteria.setProjection(proList);
6 criteria.SetProjection(proList).SetResultTransformer(new NHibernate.Transform.AliasToBeanResultTransformer(typeof(AchievementSummary))); // 要转换的类型