数据库中Float如何在list中改为Double
数据库中对应的extentValue的是Float型,用下面的Hql语句查询,返回的list中extentValue也是Float型,有没有什么办法让返回的list中的extentValue是Double型
Hql = "select checkTime,extentValue from HisSenData hs where hs.checkTime>=:bdate and hs.checkTime<=:edate and hs.site.siteId=:sid order by checkTime asc";}
------最佳解决方案--------------------使用cast 或者convert 或者to_number 等转换吧
------其他解决方案--------------------能举个例子或者就照着我这个例子改下么?这个Hql语句应该怎么写呢?下面这样报错
Hql = "select checkTime,extentValue(cast(12.1 AS double))from RealSenData hs where hs.checkTime>=:bdate and hs.checkTime<=:edate and hs.site.siteId=:sid order by checkTime asc";}
------其他解决方案--------------------谢谢了,最后发现是按下面这样写的 Hql = "select checkTime,cast(extentValue AS double) from RealSenData hs where hs.checkTime>=:bdate and hs.checkTime<=:edate and hs.site.siteId=:sid order by checkTime asc";}
------其他解决方案--------------------该回复于2012-09-24 10:50:14被版主删除