Hibernate Spatial 5 - GeometryType

后端 未结 6 1958
刺人心
刺人心 2021-02-01 16:36

After upgrading Hibernate-spatial to Version 5.0.0.CR2 the following declaration doesn\'t work anymore:

@Column(columnDefinition = \"geometry(Point,4326)\")
@Typ         


        
6条回答
  •  自闭症患者
    2021-02-01 17:17

    So I've been battling this problem for a few days, the thing is that I wanted the database type to be from the postgis type in order for me to run efficient distance queries for nearest neighbour etc. I finally figured out how to do it and wanted to share it with the community so I created a demo project containing the solution to the problem.

    My setup is a PostgreSQL database with Postgis, Spring boot jpa, Hibernate 5+, Hibernate-spatial 5+ and also added converting to rest output, which again required a special module from jackson.

    the project is found at https://github.com/Wisienkas/springJpaGeo

    the important code you was asking for was this:

    @type(type = "jts_geometry")
    private Point point;
    

提交回复
热议问题