P
P
piatachki2018-02-19 15:05:18
MySQL
piatachki, 2018-02-19 15:05:18

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 Pointfrom 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);

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2018-02-19
@piatachki

https://dev.mysql.com/doc/refman/5.7/en/spatial-re...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question