Search code examples
javahibernatespring-bootspring-data-jpapostgis

Unable to resolve name [org.hibernate.spatial.dialect.postgis.PostgisDialect] as strategy [org.hibernate.dialect.Dialect]


spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.postgis.PostgisDialect

I have a Spring Boot v1.5 application with Hibernate 5 running a Postgis database. However, I'm having issues with spatial queries, with the exception being Invalid endian flag value encountered.. Searching that exception yields me solutions of adding the appropirate SQL Dialect to the properties file. Doing that, as above, yield me the error from the title.

Running the queries directly in psql makes them work, so it's not an issue in my Postgis DB itself.

The theme of these questions is always a misspelling, but I can't find what it would be here.


Solution

  • When using the PostgisDialect you will need the hibernate-spatial project on your classpath as a dependency.

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-spatial</artifactId>
        <version>${hibernate.version}</version>
    </dependency>
    

    Adding something like the above to your list of dependencies should include the proper classes.