【发布时间】:2018-08-27 21:22:06
【问题描述】:
我正在使用这个查询来给我按小时分组的总和
@Query(value = "select sum(PC.count) as pcounts, hour(PC.time) as hourly from ProductCount as PC where PC.time >= :currentDate and PC.time < :nextDate group by hour(PC.time)")
List<Map> findByCountAndGroupByTime(@Param("currentDate") Timestamp currentDate, @Param("nextDate") Timestamp nextDate);
但是,我得到的日期结果是Integer。是的,在文档中它说小时(时间)会给出一个整数。
如果我希望它位于 Date 或 Timestamp 中,我需要更改什么?
【问题讨论】:
标签: spring hibernate spring-boot hql