HQL用于简单的SQL

时间:2013-09-05 16:50:10

标签: hibernate hql

我有以下查询..

SELECT * FROM POS_took WHERE DELETEDDATE IS NOTNULL 

我有相应的pojo ....

class postook
{

//all the properties defined here 

private DateTime deleted;

//and it corresponding setters and egetters is defined.

请告知相应的hql,我试过的内容如下所示,但它也不是一个... ...

session.createQuery("from postook where deleted is notnull")

2 个答案:

答案 0 :(得分:0)

也许是from postook pok where pok.deleted is not null。但是你得到的错误应该更清楚。

答案 1 :(得分:0)

试试这个:

session.createQuery("from postook where deleted is not null") (add space between NOT and NULL)

您的SQL查询的同意:

SELECT * FROM POS_took WHERE DELETEDDATE IS NOT NULL