@Query返回wierd错误

时间:2018-04-14 09:43:00

标签: spring spring-boot spring-data-jpa

使用谷歌地图创建商店定位器。即时通讯使用springboot-starter-jpa

并将harsvine公式放到我的存储库服务中,如下所示:

//this is store locator in km
@Query("SELECT p, (6371 * acos(cos( radians( :latitude ) ) * cos( radians( p.latitude ) ) * cos(radians( p.long ) - radians( :longitude )) +sin(radians(:latitude)) * sin(radians(p.latitude)))) AS distance FROM Location p HAVING distance < :radius ORDER BY distance LIMIT 25")
List<Location> getMeListPlaces(@Param("radius") long radius, @Param("latitude") long latitude, @Param("longitude") long longitude);

和我得到的错误如下

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: HAVING near line 1, column 233 [SELECT p, (6371 * acos(cos( radians( :latitude ) ) * cos( radians( p.latitude ) ) * cos(radians( p.long ) - radians( :longitude )) +sin(radians(:latitude)) * sin(radians(p.latitude)))) AS distance FROM com.mashitah.model.Location p HAVING distance < :radius ORDER BY distance LIMIT 25]
我在这里犯了一些错误吗?因为我把这个公式用于谷歌地图文档here

0 个答案:

没有答案