How i can use aliases on calculated columns in JPA

Viewed 29

I've the next code

@Query(nativeQuery = true, value = "select *, earth_distance(ll_to_earth(lat,lon), ll_to_earth((:lat) ,(:lon))) AS d FROM Node " +
            "where d < (:distanceInMeters)" +
            "ORDER BY d ASC")
    List<Node> getNodesByDistance(@Param("lat") Float lat,

And i got an error

org.postgresql.util.PSQLException: ERROR: column "d" does not exist

How i can use aliases there?

0 Answers
Related