More than one table found in namespace (, ) - SchemaExtractionException

后端 未结 10 2939
执念已碎
执念已碎 2021-02-20 18:52

I have been facing this weird exception while trying to persist some values into a table using Hibernate in a Java application. However this exception occurs only for one parti

10条回答
  •  一个人的身影
    2021-02-20 19:04

    We had a Spring Data / JPA application and this error started happening after upgrading to Postgres 10.6 (from 10).

    Our solution was as follows, in our JPA configuration class: note the new commented line,

    props.put("hibernate.hbm2ddl.auto", "none"); //POSTGRES 10 --> 10.6 migration

    Class:

    @Configuration
    @EnableJpaRepositories(basePackages = "app.dao")
    @ComponentScan(basePackages = { "app.service" })
    @EnableTransactionManagement
    public class JpaConfig {
    
        @Autowired
        DataSource dataSource;
    
        @Bean
        public Map jpaProperties() {
            Map props = new HashMap();
            props.put("hibernate.dialect", PostgreSQL95Dialect.class.getName());
            props.put("hibernate.hbm2ddl.auto", "none"); //POSTGRES 10 --> 10.6 migration.
            return props;
        }
    

提交回复
热议问题