【问题标题】:How to resolve org.postgresql.jdbc.PgConnection.createClob() is not yet implemented如何解决 org.postgresql.jdbc.PgConnection.createClob() 尚未实现
【发布时间】:2019-09-08 00:23:08
【问题描述】:

异常

启动 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

【问题讨论】:

    标签: java spring postgresql hibernate


    【解决方案1】:

    经过一些测试,我可以解决这个问题。似乎缺少 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'
    

    }

    【讨论】:

    • 这里有同样的经历。似乎版本 5.2.17 或 hibernate-core 和 hibernate-entitymanager 会产生错误,而版本 5.4.2.Final 不会。
    【解决方案2】:

    尝试添加

    spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
    

    【讨论】:

    • 我相信这是一个休眠错误,请在别处阅读,只需要获取更新的休眠版本。
    猜你喜欢
    • 2018-08-13
    • 2021-03-13
    • 1970-01-01
    • 2019-12-13
    • 2017-10-09
    • 2015-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多