时间:2021-07-01 10:21:17 帮助过:2人阅读
2.createQuery
2.1默认查询结果为Long
StringBuffer sb = new StringBuffer();
sb.append("select t.caiCgdId.cgdId from EmCircleApplyInfo t "); if (size != null) { sb.append(" where rownum < " + (size+1)); } sb.append(" group by t.caiCgdId.cgdId order by count(t.caiCgdId) desc"); Query query = this.getSession().createQuery(sb.toString()).setCacheable(true); List<BigDecimal> idList = query.list(); List<Long> ids = new ArrayList<Long>(); List<Long> ids = query.list();
Hibernate HQL和原生SQL查询的一点区别
标签: