【发布时间】:2018-01-19 14:33:07
【问题描述】:
我有一个域对象car。汽车属性之一是location 作为空间类型Point 存储在MySQL 中(columnDefinition 不能属于Geometry,会引发异常)。
@Type(type="org.hibernate.spatial.GeometryType")
@Column(name = "location", columnDefinition="Point")
private Point location;
使用休眠空间标准,我想获得一定半径内的空间标准。在本机 sql 中,我可以使用 ST_Distance_Sphere,但我想改用标准。问题是,这给了我一个错误org.hibernate.HibernateException: dwithin function not supported by this dialect:
final Point circleCenterPoint =
new GeometryFactory().createPoint(new Coordinate(latitude,longitude));
(...).add(SpatialRestrictions.distanceWithin(Car.LOCATION, circleCenterPoint, radiusInKm * 0.009));
我正在使用:jts-1.13、hibernate-core-4.3.4、hibernate-spatial-4.3(根据that,它们应该匹配)以及org.hibernate.spatial.dialect.mysql.MySQLSpatial56Dialect
【问题讨论】:
标签: mysql hibernate spatial spatial-query hibernate-spatial