【问题标题】:Hibernate : More than one table found: table_name休眠:找到多个表:table_name
【发布时间】:2017-11-14 17:23:11
【问题描述】:

我在我的项目中使用 Hibernate 5.x。当应用程序启动时,我不断收到以下消息并且我的应用程序没有启动。 人类可读的部分是"More than one table found: t_agent" 句子。

org.hibernate.dialect.Dialect.@156: HHH000400: 使用方言: org.hibernate.dialect.Oracle12cDialect org.hibernate.type.BasicTypeRegistry.register@138:HHH000270:类型 注册 [byte[]] 覆盖以前的: org.hibernate.type.BinaryType@149b53fa org.hibernate.type.BasicTypeRegistry.register@138:HHH000270:类型 注册 [[B] 覆盖以前的: org.hibernate.type.BinaryType@149b53fa org.hibernate.type.BasicTypeRegistry.register@138:HHH000270:类型 注册 [Byte[]] 覆盖以前的: org.hibernate.type.WrapperBinaryType@638977e0 org.hibernate.type.BasicTypeRegistry.register@138:HHH000270:类型 注册 [[Ljava.lang.Byte;] 覆盖以前的: org.hibernate.type.WrapperBinaryType@638977e0 o.h.t.s.e.i.InformationExtractorJdbcDatabaseMetaDataImpl.processGetTableResults@377: HHH000263:找到多个表:t_agent o.hibernate.jpa.internal.util.LogHelper.logPersistenceUnitInformation@31: HHH000204:处理 PersistenceUnitInfo [ 名称:defaultPersistenceUnit

【问题讨论】:

  • 也许你重复了@Table(name=t_agent) 注释?
  • 你能展示你如何使用映射实体到数据库表(@Table)吗?
  • 你能展示你如何使用映射实体到数据库表(@Table)吗?可能您已经拥有它的数据库和您的实体表 TAgent 并且您没有在 @Table 中指定 t_agent 。休眠三重奏以匹配它
  • @Entity @Table(name = "t_agent")

标签: hibernate


【解决方案1】:

最近我遇到了类似的问题,这是由于 hibernate.hbm2ddl.auto 属性值“更新”。如果可能,请删除此属性的评论。这不是最好的解决方案,但对我有用

【讨论】:

    【解决方案2】:

    添加

    <property name="hibernate.default_schema" value="myuser"/> 
    

    在 persitence.xml 中解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2016-03-06
      • 2015-05-23
      • 2021-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多