hibernate 时间比较 hql

直接上例子吧


@SuppressWarnings("unchecked")
@Override
public List<AuctionItemEntity> queryActionTopTen() {
try {
Date date=Calendar.getInstance().getTime();
String hql = "from AuctionItemEntity ai where ai.auctionEvent.startTime<=:date and ai.closed=false and ai.rejected=true ORDER BY RAND()";
Query query = getHibernateTemplate().getSessionFactory()
.openSession().createQuery(hql);
query.setTimestamp("date", date);
query.setFirstResult(0);
query.setMaxResults(10);
List<AuctionItemEntity> lst = (List<AuctionItemEntity>) query
.list();
return lst;
} catch (Exception e) {
e.printStackTrace();
}


return null;
}

hibernate 时间比较 hql,布布扣,bubuko.com

hibernate 时间比较 hql

上一篇:解决linux64位安装jpeg 出错make: ./libtool: Command not found


下一篇:Linux按文件内容查找文件