sqlgrammerexception和mysql空间类型

0s7z1bwu  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(150)

我在通过jpa执行mysql spatial数据类型的sql查询时遇到问题。我想知道提供的位置是否接近x米。我有版本为8.0的mysql,我使用以下方言

org.hibernate.spatial.dialect.mysql.MySQL56InnoDBSpatialDialect

SELECT id,title,geometry " +
        "FROM locations " +
        "WHERE ST_DISTANCE(ST_SRID(POINT(:latitude,:longitude), 4326), geometry) <= :distance " +
        "ORDER BY id DESC

控制台中出现以下异常:

[org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [SELECT id,title,geometry FROM locations WHERE ST_DISTANCE(ST_SRID(POINT(?,?), 4326), geometry) <= ? ORDER BY id DESC]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query]

请帮我找出异常的原因。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题