问题
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