日期:2014-05-17  浏览次数:20585 次

给hibernate的查询语句,如何添加当前时间条件
情况是这样的:
下面是hibernate的查询语句,查询最大时间的HQL语句,
【select max(ps.gpsTime) from Postn ps where ps.tracker.id = ? and ps.isPos = 1】
现在要加个条件是,这个最大的时间要不能大于当前时间,如何加?

------解决方案--------------------
select max(ps.gpsTime) from Postn ps where ps.tracker.id = ? and ps.isPos = 1 and ps.gpsTime <= now();
行不?