java - Hibernate HQL compare timestamp to null -
i have following hql , know how handles comparing date column null. example happens in case giventime parameter null. checked , got empty results. case? documented?
select mo myclassmo mo mo.creationdate not null , mo.creationdate >= (:giventime)
and if giventime replaced inner select query returns null? thanks
i know asked hql handling such cases prefer using called criteria in hibernate. can mixed easy sql.
jpa , hibernate - criteria vs. jpql or hql
criteria criteria = session .createcriteria(myclassmo.class) .add(restrictions.isnotnull("creationdate")); if (giventime!=null){ criteria.add(restrictions.ge("creationdate", giventime));//ge - greater equals } list<myclassmo> result = criteria.list();
Comments
Post a Comment