hibernate group by的使用 返回字段有差异

zhaiguangtao 发布于 2016/11/17 19:02
阅读 250
收藏 0

代码是:

    ProjectionList projectionList = Projections.projectionList();     projectionList.add(Projections.groupProperty("tenantid"));     projectionList.add(Projections.groupProperty("branchid"));     projectionList.add(Projections.groupProperty("softtype"));

     dc.setProjection(projectionList);

    List<SoftVersion> dataList = super.find(dc, softversion.getIDisplayStart(), softversion.getIDisplayLength());
    

我要的结果是:

SELECT
        *
    FROM
        SoftVersion this_ 
    GROUP BY
        this_.tenantid,
        this_.branchid,
        this_.softtype

但返回的结果是:

SELECT
        this_.tenantid AS y0_,
        this_.branchid AS y1_,
        this_.softtype AS y2_ 
    FROM
        SoftVersion this_ 
    GROUP BY
        this_.tenantid,
        this_.branchid,
        this_.softtype

 为什么返回的不是 全部字段,而是分组的那几个字段?
加载中
返回顶部
顶部