select * from House where
GEOGRAPHY_WITHIN_DISTANCE(geography_point(-96.926688, 32.83605), geography_point(lngtd_num,lattitude_num), 1);

Above Query works fine and gives expected results.

Trying to do same using Spring JPA, but getting an error org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node:

Here is the Spring JPA Query.
String GEO_QUERY = "select h from House h where " +
“GEOGRAPHY_WITHIN_DISTANCE(geography_point(:longitude, :latitude), geography_point(h.longitude,h.latitude), 0.15)”;

However, When I tried JPA Query with GEOGRAPHY_DISTANCE like below, it works fine.
String GEO_QUERY = "select h from House h where " +
“GEOGRAPHY_DISTANCE(geography_point(:longitude, :latitude), geography_point(h.longitude,h.latitude)) <= 0.15”;

Hi there!

We are not entirely too familiar with 3rd party APIs, so I’m not sure if you’ll get a great answer from this forum. I also don’t have any customers that’s reached out to us so far about Spring JPA. But I’ll try to point some people to see if they know what’s going on here.

Hi, thanks for your response.
GEOGRAPHY_DISTANCE is supported by Spring JPA.
How much performance impact would it be if we use GEOGRAPHY_DISTANCE instead of GEOGRAPHY_WITHIN_DISTANCE? Based on your documentation, GEOGRAPHY_DISTANCE will not be able to use Indexes for faster execution.
We have million of records to search and our Query will be more complex than just having GEOGRAPHY_DISTANCE. So, using Spring JPA will give me more flexibility of adding parameters dynamically.