criteria.setProjection(
Projections.projectionList()
.add(Projections.property("fusername"),"fusername")
.add( Projections.property("fmodulename"), "fmodulename")
.add( Projections.count("fmodulename"),"moduleCounts")
.add( Projections.groupProperty("fusername"))
.add(Projections.groupProperty("fmodulename"))
);
//返回map格式的数据
criteria.setResultTransformer(CriteriaSpecification.ALIAS_TO_ENTITY_MAP);
翻译为sql语句就是酱:
select count('f_modulename'), f_modulename ,f_username from TBTKY_VISIT_LOG_ROLE_V group by f_modulename,f_username