问题主要集中在计算总行数的时候没办法利用之前设置好的projection里的条件int totalCount = ((Integer) criteria.setProjection(Projections.rowCount()).uniqueResult()).intValue(); 
因为这句话会把之前的projection替换掉