首页 > 解决方案 > 如何解决 org.postgresql.jdbc.PgConnection.createClob() 尚未实现

问题描述

例外

启动 spring-boot 应用程序时,我收到:

原因:java.sql.SQLFeatureNotSupportedException:方法 org.postgresql.jdbc.PgConnection.createClob() 尚未实现。

我知道这与我现在正在使用的 Postgresql 驱动程序的一些问题有关。

不成功的尝试

许多人解决了这个问题,只需将以下行放在 application.properties 文件中:

spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=true

我仍然有同样的问题。它还有其他提示吗?如果考虑使用当前配置查看我的项目: https ://github.com/caliari77/hiRank

标签: javaspringpostgresqlhibernate

解决方案


经过一些测试,我可以解决这个问题。似乎缺少 Hibernate 实现,所以为了解决这个问题,我在 gradle.build 文件中添加了它。我以为 Spring-boot 在获取 JPA 时已经处理了它,但我错了。这是我从 gradle.build 更新的依赖项:

dependencies {

//Spring
//implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
//runtimeOnly 'org.springframework.boot:spring-boot-devtools'
testImplementation 'org.springframework.boot:spring-boot-starter-test'

//Hibernate
implementation 'org.hibernate:hibernate-core:5.4.2.Final'
implementation 'org.hibernate:hibernate-entitymanager:5.4.2.Final'

//Postgres
implementation 'org.postgresql:postgresql:42.2.5.jre7'

//Gson
implementation 'com.google.code.gson:gson:2.8.5'

//Logger
implementation 'log4j:log4j:1.2.17'

}


推荐阅读