Hibernate 没有JDBC类型的方言映射:7

Hibernate 没有JDBC类型的方言映射:7,hibernate,Hibernate,当我试图提取一个浮点值时,我得到了这个异常。 我正在使用MYSQL和Hibernate(Liferay) 休眠: select IFNULL(a.deltatime,0), b.vlid , a.TESTDATE from testresult a,XREFRTGTESTRESULT b where a.id = b.id and a.TESTDATE between '2011-06-01 22:03:01 ' AND '2011-06-02 22:03:01 '

当我试图提取一个浮点值时,我得到了这个异常。 我正在使用MYSQL和Hibernate(Liferay)

休眠:

select IFNULL(a.deltatime,0),   b.vlid , a.TESTDATE  
from testresult a,XREFRTGTESTRESULT b 
where a.id = b.id
    and a.TESTDATE between '2011-06-01 22:03:01 ' AND   '2011-06-02 22:03:01 '  
    and a.id='51006' 
org.hibernate.MappingException:没有JDBC类型的方言映射:7 在org.hibernate.dialogue.TypeNames.get(TypeNames.java:56)上 在org.hibernate.dialogue.TypeNames.get(TypeNames.java:81)上 位于org.hibernate.dialogue.dialogue.getHibernateTypeName(dialogue.java:368) 在org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559) 在org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485) 位于org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501) 位于org.hibernate.loader.loader.getResultSet(loader.java:1787) 位于org.hibernate.loader.loader.doQuery(loader.java:662) 在org.hibernate.loader.loader.doQueryAndInitializeNonLazyCollections(loader.java:224)上 位于org.hibernate.loader.loader.doList(loader.java:2211) 位于org.hibernate.loader.loader.listIgnoreQueryCache(loader.java:2095) 位于org.hibernate.loader.loader.list(loader.java:2090) 位于org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289) 位于org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) 位于org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) 位于org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) 在com.virtela.reports.drilldown.service.persistence.ReportsDrillDownMySQLFinderImpl.getVPNDrillDown(ReportsDrillDownMySQLFinderImpl.java:61) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)中 位于java.lang.reflect.Method.invoke(Method.java:597)
此链接可能与以下内容相关:

一句忠告:我发现将我对错误根源的最佳猜测剪切粘贴到谷歌上是很有帮助的。很可能我不是第一个遇到特殊问题的人



能否提供类定义和Hibernate映射?JDBCType7是java.sql.Types.REAL。您可能需要改为指定float或double。

它应该是固定的,因为Hibernate 3.2.5:。如果必须使用旧版本的Hibernate,可以使用以下选项之一:

  • 在数据库中使用不同的类型,例如
    double
  • 向查询添加显式强制转换:
    case(IFNULL(a.deltatime,0)为double)
  • 将您使用的
    方言子类化
    并手动注册类型
    REAL

我没有任何映射文件,我只有Hibernate.cfg文件,我正在与Liferay一起使用它。我很高兴他发布了它,而不是谷歌搜索,因为答案就是这样创建的。这是我在谷歌上得到的最热门搜索。如果没有人问,答案从一开始就不会被编入索引。如果他没有问,也许我发布的链接会在顶部。可能有更多关于SEO实践的话要说,而不是答案本身 org.hibernate.MappingException: No Dialect mapping for JDBC type: 7 at org.hibernate.dialect.TypeNames.get(TypeNames.java:56) at org.hibernate.dialect.TypeNames.get(TypeNames.java:81) at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:368) at org.hibernate.loader.custom.CustomLoader$Metadata.getHibernateType(CustomLoader.java:559) at org.hibernate.loader.custom.CustomLoader$ScalarResultColumnProcessor.performDiscovery(CustomLoader.java:485) at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:501) at org.hibernate.loader.Loader.getResultSet(Loader.java:1787) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2211) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095) at org.hibernate.loader.Loader.list(Loader.java:2090) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289) at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695) at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142) at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:150) at com.virtela.reports.drilldown.service.persistence.ReportsDrillDownMySQLFinderImpl.getVPNDrillDown(ReportsDrillDownMySQLFinderImpl.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597)