web-dev-qa-db-fra.com

La méthode org.postgresql.jdbc.PgConnection.createClob () n'est pas encore implémentée

Comment puis-je résoudre cette erreur:

Java.lang.reflect.InvocationTargetException: null
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161]
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62) ~[na:1.8.0_161]
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43) ~[na:1.8.0_161]
    at Java.lang.reflect.Method.invoke(Method.Java:498) ~[na:1.8.0_161]
    at org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl.useContextualLobCreation(LobCreatorBuilderImpl.Java:113) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.LobCreatorBuilderImpl.makeLobCreatorBuilder(LobCreatorBuilderImpl.Java:54) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.<init>(JdbcEnvironmentImpl.Java:271) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.Java:114) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.Java:35) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.Java:88) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.Java:259) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.Java:233) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.Java:210) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.Java:51) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.Java:94) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.Java:242) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.Java:210) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.Java:352) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.Java:111) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.Java:861) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.Java:888) [hibernate-core-5.2.14.Final.jar:5.2.14.Final]
    at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.Java:57) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.Java:365) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.Java:388) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.Java:377) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.Java:341) [spring-orm-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.Java:1769) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.Java:1706) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:583) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:502) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.Java:312) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:228) ~[spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:310) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:200) [spring-beans-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.Java:1085) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.Java:858) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:549) ~[spring-context-5.0.4.RELEASE.jar:5.0.4.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.Java:140) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:752) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:388) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:327) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1246) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1234) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
    at com.divergent.demo.DemoApplication.main(DemoApplication.Java:12) ~[classes/:na]



Caused by: Java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
    at org.postgresql.Driver.notImplemented(Driver.Java:683) ~[postgresql-42.2.1.jar:42.2.1]
    at org.postgresql.jdbc.PgConnection.createClob(PgConnection.Java:1252) ~[postgresql-42.2.1.jar:42.2.1]
    ... 44 common frames omitted
40
Sandeep Malviya

Ajoutez cette propriété dans votre application.properties:

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

Référence :

88
Ashutosh

J'ai eu le même problème ... J'ai suivi cette solution et cela a fonctionné pour moi

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
18
Prasad Paravatha

Résolu en ajoutant hibernate.properties with

hibernate.jdbc.lob.non_contextual_creation=true

Les autres solutions avec application.properties ne fonctionnaient pas. Cela peut aussi être fait via XML hibernate.cfg.xml 

Version Spring Boot: 2.0.2.RELEASE

9
Pafnucy

Résolu en utilisant la configuration Yaml suivante:

spring:
  jpa:
    properties:
      hibernate:
        jdbc:
          lob:
            non_contextual_creation: true
    database-platform: org.hibernate.dialect.PostgreSQL9Dialect
4
developerbhuwan

Face au même problème avec la version Spring Boot: 2.1.x.RELEASE aussi. cela a fonctionné avec:

spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true 
2
Nuwan Gunarathna

Ensemble 

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

sur vos propriétés . Pour Spring boot 2.0.x

1
Jonathan Johx
spring:      
  jpa:
    properties:
      hibernate:
        temp:
          use_jdbc_metadata_defaults: false
        jdbc:
          lob:
            non_contextual_creation: true

use_jdbc_metadata_defaults: false ou non_contextual_creation: true deux éléments fonctionnent correctement

0
mohammad hejazi

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

-> n'a pas fonctionné pour moi (botte de printemps 2.1.6)

Je mets à niveau hibernate lib à la version 5.4.2.Final et exception disparaissent :)

0
Docvominh