查询:
@Query(value = "SELECT new com.fin.iota.model.dto.TimeSeriesDto(date_trunc('hour', PC.time), sum(PC.count)) from UserCount as PC where PC.time >= :currentDate and PC.time < :nextDate group by date_trunc('hour', PC.time)")
List<TimeSeriesDto> generateTimeSeries(@Param("currentDate") Timestamp currentDate, @Param("nextDate") Timestamp nextDate);
DTO :
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TimeSeriesDto {
Date dayHour;
long pcounts;
}
错误:
Error creating bean with name 'userCountDao': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.fin.iota.repository.user.UserCountDao.generateTimeSeries(java.sql.Timestamp,java.sql.Timestamp)!
我错过了什么或者什么是不正确的?