When ever i tried to extratc a Float value , i am getting this Exception . I am using MYSQL with Hibernate (Liferay)
Hibernate:
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: No Dialect mapping for JDBC type: 7 at org.hibernate.dialect.Type开发者_Python百科Names.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)
This link might be pertinent:
https://forum.hibernate.org/viewtopic.php?f=1&t=973997&view=next
A word of advice: I find it helpful to cut & paste my best guess as to root cause of an error into Google. Chances are good that I'm not the first to encounter a particular problem.
Can you provide your class definition and Hibernate mapping? JDBC type 7 is java.sql.Types.REAL. You might need to specify float or double instead.
It should be fixed since Hibernate 3.2.5: HHH-2663. If you have to use older version of Hibernate, you can use one of the following options:
- Use different type in the database, such as
double
- Add explicit cast to the query:
case(IFNULL(a.deltatime,0) as double)
- Subclass the
Dialect
you use and register typeREAL
manually
精彩评论