使用Springboot连接Postgresql 使用JPA

版本:

        spring-boot:2.1.0.RELEASE

        org.postgresql.postgresql:42.2.5

分析:

    跟踪代码找到:LobCreatorBuilderImpl:41

boolean isNonContextualLobCreationRequired = ConfigurationHelper.getBoolean("hibernate.jdbc.lob.non_contextual_creation", configValues);
        if (isNonContextualLobCreationRequired) {
            LOG.disablingContextualLOBCreation("hibernate.jdbc.lob.non_contextual_creation");
            return false;
        } else if (jdbcConnection == null) {
            LOG.disablingContextualLOBCreationSinceConnectionNull();
            return false;
        } 

    只需配置参数:hibernate.jdbc.lob.non_contextual_creation

解决方案:

    1、在 application.properties 配置:

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

    2、在 application.yml 同级目录下添加 hibernate.properties 文件,并配置:

hibernate.jdbc.lob.non_contextual_creation=true

 

更多推荐