Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented

前端 未结 8 2143
迷失自我
迷失自我 2020-12-12 23:25

How can I solve this error:

java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_1         


        
相关标签:
8条回答
  • 2020-12-12 23:40

    Add this property in your application.properties :

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

    Reference :

    • https://github.com/spring-projects/spring-boot/issues/12007#issuecomment-369388646
    0 讨论(0)
  • 2020-12-12 23:43

    Solved by using following Yaml configuration:

    spring:
      jpa:
        properties:
          hibernate:
            jdbc:
              lob:
                non_contextual_creation: true
        database-platform: org.hibernate.dialect.PostgreSQL9Dialect
    
    0 讨论(0)
  • 2020-12-12 23:44

    I had the similar issue. I followed this solution and it worked for me

    http://vkuzel.blogspot.com/2016/03/spring-boot-jpa-hibernate-atomikos.html

    # Disable feature detection by this undocumented parameter. Check the org.hibernate.engine.jdbc.internal.JdbcServiceImpl.configure method for more details.
    spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults = false
    
    # Because detection is disabled you have to set correct dialect by hand.
    spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect
    
    0 讨论(0)
  • 2020-12-12 23:51

    Faced the same problem with Spring Boot version: 2.1.x.RELEASE too. it worked with:

    spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true 
    
    0 讨论(0)
  • 2020-12-12 23:53

    I was struggling with this stuff for a day.

    • Spring boot version 2.2.5

    • Postgres: 42.2.10

    • Version of Postgres on server: PostgreSQL 11.6 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.9.3, 64-bit

    I was using Spring JPA data with Hibernate configuration. Using sessionFactory.

    Hibernate configuration:

    @Bean(name = "sessionFactory")
    @Primary
    public LocalSessionFactoryBean sessionFactory(){
        LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
        sessionFactoryBean.setDataSource(assetHealthDataSource);
        sessionFactoryBean.setMappingDirectoryLocations(new Resource[]{new ClassPathResource("mappings")});
        sessionFactoryBean.setHibernateProperties(hibernateProperties());
    
        return sessionFactoryBean;
    }
    

    Hibernate Properties:

    private final Properties hibernateProperties() {
        Properties hibernateProperties = new Properties();
        hibernateProperties.setProperty(
                "hibernate.dialect", "org.hibernate.dialect.PostgreSQL9Dialect");
        hibernateProperties.setProperty(
                "hibernate.jdbc.lob.non_contextual_creation", "true");
        hibernateProperties.setProperty(
                "hibernate.temp.use_jdbc_metadata_defaults", "false");
        hibernateProperties.setProperty(
                "hibernate.show_sql", environment.getProperty("assetHealthDataSource.hibernate.showSQL"));
        hibernateProperties.setProperty(
                "hibernate.format_sql", environment.getProperty("assetHealthDataSource.hibernate.formatSQL"));
        hibernateProperties.setProperty(
                "hibernate.transaction.auto_close_session", "false");
        hibernateProperties.setProperty(
                "hibernate.hibernate.connection.release_mode", "auto");
        hibernateProperties.setProperty(
                "hibernate.hikari.maximumPoolSize", "3");
        hibernateProperties.setProperty(
                "hibernate.default_schema", "MY_SCHEMA");
    
        return hibernateProperties;
    }
    

    But everything was not working properly. Willing to see any suggestion that can help to solve this out. Thank you very much.

    0 讨论(0)
  • 2020-12-12 23:54

    Solved by adding hibernate.properties with

    hibernate.jdbc.lob.non_contextual_creation=true
    

    Other solutions with application.properties didn't work. This can be also done via XML hibernate.cfg.xml

    Spring Boot version: 2.0.2.RELEASE

    0 讨论(0)
提交回复
热议问题