Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Jpa查询将部分查询作为参数发送_Postgresql_Spring Boot_Jpa_Spring Data Jpa_Hql - Fatal编程技术网

Postgresql Jpa查询将部分查询作为参数发送

Postgresql Jpa查询将部分查询作为参数发送,postgresql,spring-boot,jpa,spring-data-jpa,hql,Postgresql,Spring Boot,Jpa,Spring Data Jpa,Hql,我不想这样问: @Query( nativeQuery = true, value = "select vp.id , vp.identity, vp.vehicle_id, dt.i " + "from vehicle_plate vp" + " inner join (select max(vp2.id) as id, vp2.vehicle_id as vId

我不想这样问:

@Query(
            nativeQuery = true,
            value = "select vp.id , vp.identity, vp.vehicle_id, dt.i " +
                    "from vehicle_plate vp" +
                    "  inner join (select max(vp2.id) as id, vp2.vehicle_id as vId from vehicle_plate vp2 group by vp2.vehicle_id) as vpg" +
                    "  ON vp.id = vpg.id and vp.vehicle_id = vpg.vId" +
                    "  cross join (values :dates ) dt(i)" +
                    "where vp.vehicle_id in (:vehicleIds)"
    )
    Page<Object[]> findAllJoinByDate(
            @Param("dates") List<java.util.Date> dates,
            @Param("vehicleIds") List<Integer> vehicleIds,
                                 Pageable pageable
   );

有解决办法吗?

我有一种明显的感觉,您正面临类似的问题。但是,不能保证相同的解决方案对您有效。此外,除了“克隆”行外,
:dates
的内容是否以任何方式影响结果?我看不到使用日期列表筛选的任何内容,为什么需要在查询中使用它?
cross join (values ('2019-10-08') , ('2019-09-07') ) dt(i)