public List<PeptideCountForm> getPurePeptideCountForms(
final String purePeptide) {
final String hql = "select new "
+ PeptideCountForm.class.getName()
+ "(proj.id, proj.name, count(sp.id)) from Project proj, SequestPeptide sp where sp.purePeptide = ? and sp.project.id = proj.id group by proj.id, proj.name";
List objs = (List) getHibernateTemplate().find(hql, purePeptide);
return RcpaObjectUtils.asList(objs);
}
关键的地方就是:
1、在HQL中PeptideCountForm必须是全路径的classname
2、PeptideCountForm有一个完全吻合的constructor