我在 JPA存储库中有原生查询:
public interface TaskRepository extends PagingAndSortingRepository<Task, Integer> {
@Query( nativeQuery = true, value = "select min(t_id) as id, sum(t_estimation_time) as estimationTime, max(t_due_date) as maxDueDate, min(t_due_date) as minDueDate "
+ "from kat_task inner join kat_task_to_workstream on t_id = ttw_frn_task_id "
+ "inner join kat_workstream on ws_id = ttw_frn_workstream_id and t_is_active is true and t_completed_at is null and t_is_active is true "
+ "where ws_id= :workstreamId" )
DueDatesAndEstimationTimeBean getDueDatesAndEstimationTime( @Param( "workstreamId" ) Integer workstreamId );
}
但是,当我运行上述查询时,我得到了异常
org.springframework.core.convert.ConversionFailedException:失败 从类型[java.lang.Object []]转换为type [com.kat.beans.DueDatesAndEstimationTimeBean] for value&#39; {15666, 10800000,2017-04-27 14:21:16.0,2017-03-13 12:20:33.0}&#39 ;;嵌套 例外是 org.springframework.core.convert.ConverterNotFoundException:没有 转换器发现能够从类型[java.lang.Integer]转换为 输入[com.kat.beans.DueDatesAndEstimationTimeBean]。
为什么它无法转换?我是Spring数据JPA的新手。请帮忙