【问题标题】:Hibernate cannot auto create a table in database1 if there exists another table with the same name in another database2如果另一个数据库 2 中存在另一个同名表,Hibernate 无法在数据库 1 中自动创建一个表
【发布时间】:2017-05-02 02:36:07
【问题描述】:

据说我有两个数据库。一个 db 的名称是 db1,另一个是 db2。当我将数据库切换到 db 并让 hiberate 为我创建表(使用实体注释)时,它不会在 db1 中为我创建新表,因为 db2 中已经存在名称表名。

原因:javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory 引起:org.hibernate.tool.schema.extract.spi.SchemaExtractionException:在命名空间(,)中找到多个表:schemaConfig

【问题讨论】:

  • 请提供更多详细信息以及正在使用的错误消息和代码。

标签: mysql spring hibernate


【解决方案1】:

我的 Hibernate 版本太低。我用了 `

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.2.2.Final</version>
</dependency>

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-entitymanager</artifactId>
    <version>5.2.2.Final</version>
</dependency>

然后我切换到 5.2.9,问题就消失了。 不知道为什么

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-30
    • 2010-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-20
    相关资源
    最近更新 更多