Hibernate 接收count(*) 等多个字段值

HQL:select author,count(*) from test where author="admin"


List results = session.createQuery(hql).list();
for (Iterator iterator = results.Iterator(); iterator.hasNext(); ) {
       Object[] rows = (Object[]) iterator.next();
        Integer count = (Integer) rows[0];
        String author = (String) rows[1];
   }

你可能感兴趣的:(Hibernate)