エンティティ クラスに参加して BO を作成しようとしています
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"))
.add( Projections.property("t.Typ"))
.add( Projections.property("pe.bId"))
.add( Projections.property("m.model"))
.add( Projections.property("s.decay"))
).setMaxResults(100)
.addOrder(Order.asc("r.Id"))
.setResultTransformer(Transformers.aliasToBean(BO.class));
100 個の空の BO を取得しています。つまり、すべてのプロパティが null です。私の BO は次のとおりです。
public class BO implements Serializable {
private static final long serialVersionUID = 1L;
private int Id;
private String Typ;
private String bId;
private String model;
private String decay;
Getters and Setters
.....
aliasToBean の行を削除して Object[] を反復処理すると、正しい値がフェッチされていることがわかりました。