下面的给定查询不起作用
@Query(value="select * from ngb.security_deposit sd where sd.consumer_no = :consumerNo and (sd.effective_start_date, sd.effective_end_date) OVERLAPS (:effectiveStartDate::DATE, :effectiveEndDate::DATE) order by sd.effective_start_date asc",nativeQuery=true)
public List<SecurityDepositInterface> findByConsumerNoAndEffectiveStartDateAndEffectiveEndDate(@Param("consumerNo") String consumerNo, @Param("effectiveStartDate") Date effectiveStartDate, @Param("effectiveEndDate") Date effectiveEndDate);显示java.lang.IllegalArgumentException:名为effectiveStartDate的参数不存在
发布于 2017-11-17 15:41:52
在您的存储库中
@Query(value="select * from ngb.subsidy where (effective_start_date, effective_end_date) OVERLAPS ('2017-08-01'::DATE, '2017-08-01'::DATE) order by effective_start_date asc",nativeQuery=true)
List<Your Entity class> = findbyID(); // any name发布于 2017-11-18 21:03:11
不要使用?1而使用@Param("")
示例
@Query(value="select * from table where colNO=?1 and colNO=?2",nativeQuery=true)
List<Your Entity class> = findbyID(String val1,String val2); https://stackoverflow.com/questions/47345451
复制相似问题