Home > Software design >  Is PostgisPG10Dialect superseded by PostgreSQLDialect now?
Is PostgisPG10Dialect superseded by PostgreSQLDialect now?

Time:10-25

I am using hibernate-spatial in version 6.1 with PostgreSQL 12.12.

According to older guides or this question, org.hibernate.spatial.dialect.postgis.PostgisDialect is the right dialect to use. However, this dialect does not exist anymore. The newest PostgisDialect is PostgisPG10Dialect. This dialect tells me it is superseded by org.hibernate.dialect.PostgreSQLDialect.

I am confused because this is the opposite to everything I could find on the web. Yet, if I follow the advise my life code gives me, I get this:

INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
Okt. 22, 2022 6:11:11 PM org.hibernate.spatial.dialect.postgis.PostgisDialectContributor contributeJdbcTypes
INFO: HHH80000003: hibernate-spatial adding type contributions from : org.hibernate.spatial.dialect.postgis.PostgisDialectContributor

This lets me assume that with version (6?) hibernate-spatial changed from having its own dialect to having a "DialectContributer" that is loaded automatically and adds to whatever dialect is used (assuming the dialect fits to the actual DBMS, of course).

Basically my question here is: where is this documented? Searching for "PostgisDialectContributor" gives me really few search results.

CodePudding user response:

Yes, for Hibernate 6 and later you don't need the SpatialDialects anymore for most databases. You only need to have the Hibernate Spatial module jar on the classpath, and the Spatial support (functions & Hibernate types) will be added automatically.

  • Related