Hibernate 自动更新表出错 More than one table found in namespace

报错:Caused by: org.hibernate.tool.schema.extract.spi.SchemaExtractionException: More than one table found in namespace (, ) : data_source

可能原因:在其他catalog schmea 下存在同名表或表名符合格式data_source(如data1source)。

若是在其他catalog schmea 下存在同名表,可配置默认catalog 和schema。

hibernate 中配置参数default_catalog、default_schema,根据数据库是否支持catalog、schema 进行配置。

spring data jpa 中配置方式是在配置文件(application.properties)中配置参数schema,如

spring.jpa.properties.hibernate.default_catalog=yourCatalog

spring.jpa.properties.hibernate.default_schema=yourSchema

若表名符合格式data_source,那就需要自己建表然后取消自动更新ddl。即可能需要寻求其他方式解决。

原文地址:https://www.cnblogs.com/phoenix-smile/p/6848692.html