我在sql后面有以下HQL ..
SQL ....
SELECT * FROM POS_took WHERE DELETEDDATE IS NOT NULL
它对应的HQL是......
session.createQuery("from postook where deleted is not null")
和java Entity类是......
class postook
{
//all the properties defined here
private DateTime deleted;
//and it corresponding setters and getters is defined.
现在请告知上述HQL的等效标准表示
答案 0 :(得分:2)
Criteria criteria = getSession().createCriteria(postook.class);
criteria.add(Restrictions.isNotNull("deleted"));
详情请见http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch12.html