JPA错误之Failed to convert from type [java.lang.Object[]] to type

问题背景,想要通过jpa获取对象列表信息:



public interface CustodyPaymentScheduleDao extends JpaRepository<HRUserInfo, String> {

@Query(value = "select b.* from custody_abnormal_record_list a ,custody_payment_schedule b where a.contract_no = b.contract_no and a.REPAY_DATE =:repayDate AND a.PUSH_STATUS = '0' and b.channel = '99'order by a.create_time desc", nativeQuery = true)

List<CustodyPaymentSchedule> queryCustodyPaymentSchedule(@Param(value = "repayDate") String repayDate);

}

 

运行时报错:

Failed to convert from type [java.lang.Object[]] to type

 

原因:是继承JpaRepository接口是忽略了转换器参数类型的定义 JpaRepository<HRUserInfo, String> 

转换器的参数类型定义与方法接收的参数类型List<CustodyPaymentSchedule>不匹配,修改成一致就ok了


版权声明:本文为weixin_39851884原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。