我使用了这个技巧:
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 (?, ?, ?, ?)
你认为他们是平等的陈述吗?