如何在hibernate中实现以下多个内连接?

时间:2015-08-06 17:07:38

标签: java sql hibernate criteria

我hava查询:

     Hibernate: select this_.pName as y0_, this_.kNum as y1_, count(*) as y2_ from ALL_CPView this_ inner join ALL_AMView aID1_ on this_.agentid=aID1_.AgentID 

和标准,

      Criteria crit = statelessSession.createCriteria(APRecord.class, "apr")
                .createAlias("manageID", "ID", Criteria.INNER_JOIN);
     crit.setProjection(Projections.projectionList()
                .add(Projections.groupProperty("PName"), "PName")
                .add(Projections.groupProperty("kNum"), "kNum")
                .add(Projections.rowCount() , "count"));
        results =  crit.setResultTransformer(Transformers.aliasToBean(APStat.class)).list();

如何使用内部联接添加另一个具有针对aID的不同计数的投影?

0 个答案:

没有答案