如何通过限制进行NOT IN语句

时间:2011-01-09 00:38:51

标签: java sql hibernate hibernate-criteria

我使用了这个技巧:

List statuses = new ArrayList();
Criteria criteria = session.createCriteria(MessageQueue.class);
criteria.add(Restrictions.not(Restrictions.in("message_status", statuses)));

并且此代码创建:

...from MESSAGE_QUEUE mq where not (mq.message_status in (?, ?, ?, ?))...

但我需要:

...from MESSAGE_QUEUE mq where mq.message_status  NOT IN (?, ?, ?, ?)
你认为他们是平等的陈述吗?

0 个答案:

没有答案