1

I have been trying to port an existing application using PostGIS from Spring 5 to Spring 6. I get an error saying that org.hibernate.spatial.dialect.postgis.PostgisDialect is not more available:

Task :packages:discover-app-back-api:bootRun FAILED Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.spatial.dialect.postgis.PostgisDialect] as strategy [org.hibernate.dialect.Dialect] Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.spatial.dialect.postgis.PostgisDialect] Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.spatial.dialect.postgis.PostgisDialect

  • Spring boot 3.0.2
  • Spring security 6.0.1
  • Hibernate 6.1.6

Indeed, this class is no more available in the version 6.X. What configuration should I use?

pppery
  • 3,731
  • 22
  • 33
  • 46
  • 2
    This seems more a Spring question than a PostGIS one. [so] is probably a better resource for this. – Vince Feb 06 '23 at 12:30

1 Answers1

3

You no longer need to specify the dialect:

The PostgisDialect class was first replaced by PostgisPG9xDialect / PostgisPG10Dialect classes, but now these are also deprecated ("A SpatialDialect is no longer required.").

So the correct dialect is the default (org.hibernate.dialect.PostgreSQLDialect).

But since it is the default it shouldn't be necessary to specify it in your Spring-Boot application, both the default driver and dialect can be derived from what you specify in spring.datasource.url

wab
  • 31
  • 1