Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PostgisDialect vs PostgreSQLDialect or both?

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?

like image 591
balteo Avatar asked May 30 '14 13:05

balteo


1 Answers

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.

like image 57
John Powell Avatar answered Oct 12 '22 11:10

John Powell