How to make NOT IN statement via Restrictions

Posted by slavig on Stack Overflow See other posts from Stack Overflow or by slavig
Published on 2011-01-09T00:38:51Z Indexed on 2011/01/09 0:53 UTC
Read the original article Hit count: 118

Filed under:
|
|
|

I used this trick:

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

and this code creates:

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

but I need:

...from MESSAGE_QUEUE mq where mq.message_status  NOT IN (?, ?, ?, ?)

Du you think they are equal statements?

© Stack Overflow or respective owner

Related posts about java

Related posts about sql