Postgres Error method org.postgresql.jdbc.PgConnection.createClob() is not implemented

元气小坏坏 提交于 2019-12-03 10:03:43

TL;DR

  • Set spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true in your application.yml or,
  • Set hibernate.jdbc.lob.non_contextual_creation=true in your persistence.xml

It's a known error in JBoss community.

This error appears in former versions and new version with Spring-Boot 2.0.0.RC1 as well and higher.

Solution:

  1. Update your postgressql-driver with a newer backward compatible version.
    • Set spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true in your application.yml or,
    • Set hibernate.jdbc.lob.non_contextual_creation=true in your persistence.xml
  2. If it's not working see this trick below:

The solution is to add this line in your property file (or something similar if your are not using spring)

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

So, your application.yml should looks like:

spring:
    application:
      name: employee-service

    datasource:
      url: jdbc:postgresql://localhost:5432/db_development
      platform: POSTGRESQL
      username: ...
      password: ...

    jpa:
      hibernate:
        ddl-auto: create-drop
        dialect: org.hibernate.dialect.PostgreSQL9Dialect
        show_sql: true
      properties.hibernate.temp.use_jdbc_metadata_defaults: false


server:
  port: 8080

Reference:

https://o7planning.org/en/11661/spring-boot-jpa-and-spring-transaction-tutorial

hibernate with c3p0: createClob() is not yet implemented

Thanks to Binakot for his comment bellow. I have updated the post.

superup

put this in to application.properties

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

PostgreSQL doesn't really have "CLOB". Just use setString(String) or setObject(...) with Types.STRING.

using spring-boot 2.1.9.RELEASE I added the following and it worked

spring:
  jpa:
    properties.hibernate.temp.use_jdbc_metadata_defaults: false
    database-platform: org.hibernate.dialect.PostgreSQL94Dialect
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!