我在使用PostGIS和Spring Boot 3.0的Hibernate Spatial 6时遇到了一些问题。这个项目我已经采取并升级到SB 3.0 SNAPSHOT:https://github.com/murphye/spring-boot-postgis/tree/3.0
当我尝试运行一个查询时,我得到了这个错误:
Caused by: org.postgresql.util.PSQLException: ERROR: Invalid endian flag value encountered.
我正在设置方言,但据说有了Hibernate 6,这应该不再是必要的:
database-platform: org.hibernate.spatial.dialect.postgis.PostgisPG10Dialect
以下是导致问题的列:
@Column(columnDefinition = "geometry(Point,4326)")
private Point geom;
以及查询:
@Query(value="SELECT * from us_cities where ST_DistanceSphere(geom, :p) < :distanceM", nativeQuery = true)
有什么想法吗?它在Spring Boot 2.5中工作。非常感谢。
更新:我开始工作了。我不得不做一些调整,但主要的变化是使用定位技术包,而不是生动的解决方案。我认为Hibernate 6可能需要进行此更改。
我还不得不使用一个与定位技术协同工作的jackson数据类型jts的分支。
我还能够注释出Hibernate 6不再需要的一些Spring Boot配置(例如数据库平台(。
代码位于3.0分支上:https://github.com/murphye/spring-boot-postgis/tree/3.0