spring.jpa.properties.hibernate.dialect=org.hibernate.spatial.dialect.postgis.PostgisDialect
我有一个 Spring Boot v1.5 应用程序和运行 Postgis 数据库的 Hibernate 5。但是,我在空间查询方面遇到问题,但
Invalid endian flag value encountered.
除外。搜索该异常会产生将适当的 SQL 方言添加到属性文件的解决方案。如上所述,这样做会产生标题中的错误。
直接在
psql
中运行查询使它们工作,所以这在我的 Postgis DB 本身中不是问题。
这些问题的主题总是拼写错误,但我找不到它会在这里。
PostgisDialect
时,您需要将 hibernate-spatial
项目作为依赖项放在类路径中。
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>${hibernate.version}</version>
</dependency>
将上面的内容添加到依赖项列表中应该包括适当的类。
将方言更改为
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
派对迟到了,但这是我的 2 美分:
org.hibernate.spatial.dialect.postgis.PostgisDialect 在更高版本的 hibernate 中已经被弃用,所以你可能想切换到其他东西,比如 PostgisPG92Dialect,...