尝试显式地对
ProjectionList项目进行别名化,以匹配Bean中的字段名称,如下所示:
Criteria criteria = session.createCriteria(Report.class,"r");criteria.createAlias("template", "t").createAlias("constituents", "rc").createAlias("rc.entity", "pe").createAlias("pe.model", "m").createAlias("pe.scenario", "s").setProjection(Projections.projectionList() .add( Projections.property("r.Id"), "Id") .add( Projections.property("t.Typ"), "Typ") .add( Projections.property("pe.bId"), "bId") .add( Projections.property("m.model"), "model").add( Projections.property("s.decay"), "decay") ).setMaxResults(100) .addOrder(Order.asc("r.Id")) .setResultTransformer(Transformers.aliasToBean(BO.class));


