【问题标题】:What causes this org.hibernate.MappingException?是什么导致了这个 org.hibernate.MappingException?
【发布时间】:2011-02-12 21:40:48
【问题描述】:

我正在尝试配置一个 ejb3 示例应用程序,它是映射到 postgres 的实体现在我希望该应用程序使用 JPA 在 Jboss4.3 和 Informix 上运行。

如果 DDL 创建 <property name="hibernate.hbm2ddl.auto" value="create"/> 处于活动状态,则会出现此错误

> WARN  [ServiceController] Problem
> starting service
> persistence.units:ear=weblog.ear,jar=weblog.jar,unitName=weblog
> javax.persistence.PersistenceException:
> [PersistenceUnit: weblog] Unable to
> build EntityManagerFactory
>         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
>         at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
>         at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:246)

紧随其后

Caused by: org.hibernate.MappingException: No Dialect mapping for JDBC type: 2005
            at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)
            at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)
            at org.hibernate.dialect.Dialect.getTypeName(Dialect.java:291)
            at org.hibernate.mapping.Column.getSqlType(Column.java:182)
            at org.hibernate.mapping.Table.sqlCreateString(Table.java:394)
            at org.hibernate.cfg.Configuration.generateSchemaCreationScript(Configuration.java:854)
            at org.hibernate.tool.hbm2ddl.SchemaExport.<init>(SchemaExport.java:74)
            at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:311)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300)
            at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:874)
            at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)

JDBC 类型:2005 是什么意思? 知道如何追踪导致问题的实体/列吗?

谢谢

【问题讨论】:

  • 您是否尝试在映射和配置文件中搜索任何出现的2005
  • 是的,2005 年没有发生

标签: hibernate jpa jboss ejb-3.0 informix


【解决方案1】:

请注意,有一个新的(截至 2010 年 4 月 26 日)网页 http://www.iiug.org/opensource,其中包含有关将 Informix 软件与各种开源软件包(包括 Hibernate)一起使用的信息。特别是,有可下载的代码改进了 Hibernate 和 Informix 的交互。

【讨论】:

    【解决方案2】:

    有关您尝试映射的数据类型的更多信息会很好。 看看这个 Hibernate 论坛帖子 -> https://forum.hibernate.org/viewtopic.php?f=1&t=950692&start=0

    【讨论】:

    • +1 你可能把我引向了关于数据类型的正确方向,我花了几个小时将 postgres DDL 转换为 informix,现在出现的问题是另一个问题。谢谢