收录日期:2019/06/20 13:56:54 时间:2010-06-23 00:46:11 标签:java,hibernate,count

I am using the Projections.rowCount() function on Hibernate, but it will only return the counts greater than 0. I need to get the list with the 0 count too.

This is the function supposed to give me the count but it only returns counts greater than 1.

public List<Object[]> getCuentaPorEnlotar() {
    DetachedCriteria criteria = casosEstadoCriteria(Caso.EstadoOperativo.COMPLETADO, Caso.EstadoAdministrativo.TARIFICADO);
    criteria.add(Restrictions.isNull("lote"));
    criteria.setProjection(Projections.projectionList()
            .add(Projections.groupProperty("cliente"))
            .add(Projections.rowCount()));
    criteria.addOrder(Order.desc("cliente"));
    return (List<Object[]>) getHibernateTemplate().findByCriteria(criteria);
}