简体   繁体   中英

How to compare two dates

public List<Object[]> Medicine(java.util.Date asd){
    String hql = "select u.date, from EsencijalnaLista where u.date > :s";
    Query query = HibernateUtil.getSession().createQuery(hql);
    query.setParameter("s", asd);
    return query.list();
}

This is a query and I want to compare 2 dates. One is selected and it is "asd". The second is in a database and it is compared.

It looks like your HQL is just missing anything saying what u is. Try:

String hql = "select u.date from EsencijalnaLista as u where u.date > :s";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM