这是我的课程、档案、候选人、编队和行动:
public class Dossiers implements java.io.Serializable {
private Integer iddossier;
private Candidat candidat;
private Formation formation;
private String currentstate;
}
public class Candidats implements java.io.Serializable {
private Integer idcandidat;
private String name;
}
public class Formation implements java.io.Serializable {
private Integer idFormation;
private String formationName;
}
public class Actions implements java.io.Serializable {
private Integer idAction;
private Date dateexecution;
private List<Dossiers> listDossiers;
}
这是我的代码,想要获得一个具有不同 ID 的列表。
DetachedCriteria criteria = DetachedCriteria.forClass(Dossier.class);
if(thisview > 0){
criteria.createAlias("formation", "formation").add(Restrictions.eq("formation.idformation", thisview));
}
if (state != null) {
criteria.add(Restrictions.eq("currentstate", state));
}
if (name != null){
criteria.createAlias("person", "person").add(Restrictions.eq("candidat.name", name));
}
criteria.addOrder(Order.desc("iddossier"));
List<Dossier> dList = findByCriteria(criteria);
return dList;
但是当我在下面添加这一行时,我得到了一个错误
criteria.setProjection(Projections.alias(Projections.groupProperty("iddossier"), "iddossiers"));
有什么建议吗?