mysql hibernate createSQLQuery时间戳范围结果为null

时间:2016-10-25 14:07:44

标签: java mysql sql hibernate datetime

mysql查询字符串是

SELECT d.sn,
       CONVERT(AVG(dd.light), SIGNED) as light,
       CONVERT(MAX(dd.light), SIGNED) as hlight,
       CONVERT(MIN(dd.light), SIGNED) as llight,
       CONVERT(AVG(dd.wetness), SIGNED) as dwetness,
       CONVERT(MAX(dd.wetness), SIGNED) as hdwetness,
       CONVERT(MIN(dd.wetness), SIGNED) as ldwetness,
       CONVERT(AVG(dd.temp), SIGNED) as temp,
       CONVERT(MAX(dd.temp), SIGNED) as htemp,
       CONVERT(MIN(dd.temp), SIGNED) as ltemp
  from device_data dd, device d
 where d.id = dd.device_id
   and dd.device_id = 396
   and dd.wetness <= 100
   and dd. timestamp >= '2016-10-24 00:00:00'
 GROUP BY d.id

当我使用navicat时,它返回正确的值,但是当我使用
SQLQuery query = session.createSQLQuery(senseDataSql);

它返回null,我不知道为什么?

0 个答案:

没有答案