Answer the question
In order to leave comments, you need to log in
Is it possible to work with spatial data in MySQL/MariaDB through JPA repositories?
Good afternoon!
I'm trying to work through CrudRepository with entities whose fields have a type Point
from spring.data.geo
. The documentation (Appendix D) allows geo-types of returned data, but there is a footnote that only for those storages that support. But there are no examples of HQL queries for geodata. Russian Wikipedia states that MySQL supports the corresponding operations in version 5.
On the other hand, all the examples I've found work with MongoDB repositories, they have special keywords like near, isNear, Within, etc. When trying to use them with a MySQL source IllegalArgumentException: Unsupported keyword
, . There are suspicions that the spring.data.geo package is not designed to work with SQL stores at all.
Concretizing the question, how can I select from the database all points (spring.data.geo.Point type) within a radius of 10 km, for example, from the specified one. What an HQL query should look like. Please, who came across, give a link to an example for MySQL or bring your own.
@Query("select p from POI p where ??? ")
GeoResults<> getPOI(Point, Distance);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question