HQL中的时间比较

来源:互联网 发布:淘宝网下载ipad版 编辑:程序博客网 时间:2024/05/02 03:02

 

String hql = "from TradeRecord as tr where tr.TradeTime>= :startTime "
+ "and tr.TradeTime <= :endTime and tr.CustomerId =:cid";
String[] params = { "startTime", "endTime", "cid" };
Object[] args = { startTime, endTime, new Long(cid) };
List list = this.getHibernateTemplate().findByNamedParam(hql, params, args);

startTime,endTime,cid是这个方法的参数

 
原创粉丝点击