PostgisDialect vs PostgreSQLDialect or both?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 15:32:48

问题


My application is going to use the following technologies:

  • Postgresql
  • Postgis
  • JPA/Hibernate
  • Spring
  • Spring Data JPA

I understand (from the Hibernate Spatial documentation) that one has to use the following dialect: org.hibernate.spatial.dialect.postgis.PostgisDialect

What I don't understand though is how the above dialect relates to the standard Posgresql dialect, i.e. org.hibernate.dialect.PostgreSQLDialect...

Is the Postgis dialect a superset of the standard Posgresql dialect?

Will all features of the latest standard Posgresql dialect be available in the Postgis dialect?

I guess I can't use several/multiple dialects on the same entityManager factory... Then what are the best practices to get the best of both dialects?


回答1:


The PostgisDialect actually extends the Postgresql dialect, so, yes, it is a superset. See the class declaration: PostgisDialect class declaration

There is a good tutorial here: Hibernate spatial with Postgis that show that you only need to include the Postgis Dialect in order to persist both spatial and non-spatial fields.

Postgis primary provides support for spatial objects on top of Postgresql. A Postgis installation also includes GEOS (a C++ port of Java Topology Suite) which provides many of the actual geometric functions, Proj4, which provides support for different coordinate systems/projections and GDAL, which is a conversion utility between various geographical data formats.



来源:https://stackoverflow.com/questions/23955451/postgisdialect-vs-postgresqldialect-or-both

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!