您的位置:首页 > 其它

hibernate如何使用hql语句查询时间区间段

2017-06-08 17:48 330 查看
1、写出类似于 以下的hql语句 

[java] view
plain copy

hql = "from TeacherAward where awardState = 2  and  awardTime >= ? and awardTime <= ?  ";  

2、查询时的操作语句为:

[java] view
plain copy

Query query = getSessionFactory().getCurrentSession().createQuery(hql);  

        query.setDate(0, startTime);  

        query.setDate(1,stopTime );
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  hibernate hql