Spring JPA Native Query没有给出结果集

时间:2018-05-24 18:47:18

标签: spring-boot spring-data-jpa

当通过spring boot JPA CrudRepository类运行时,Below查询没有从DB返回任何结果。

  @Query(nativeQuery = true, value = "SELECT *,(6371 * acos(cos( radians((?2)) ) * cos( radians(latitude)) * cos(radians(longitude) - radians((?3))) + sin(radians((?2))) * sin(radians(latitude)))) as distance FROM Table_Name where service_id =(?1) HAVING distance <3 ORDER BY distance LIMIT 5;")
      List<Respone> findNearByPlacesByService(Integer service, float lat,
          float longg);

在控制台上检查hibernate sql查询日志时,似乎没有在查询中注入参数。日志中没有例外。

控制台日志:

Hibernate: SELECT *,(6371 * acos(cos( radians((?)) ) * cos( radians(latitude)) * cos(radians(longitude) - radians((?))) + sin(radians((?))) * sin(radians(latitude)))) as distance FROM merchant_outlet_services where service_id =(?) HAVING distance <3 ORDER BY distance LIMIT 5;

0 个答案:

没有答案