Hibernate not方法:逻辑非操作

  • 内容
  • 评论
  • 相关

not 方法用于完成“逻辑非”操作。

语法:

not(Criterion expression)

参数说明:

  • expression:用于指定一个表达式。

返回值:Criterion 对象的示例。

示例

查询学历不为“大专”、“本科”和“研究生”的员工信息,关键代码如下:

Criteria criteria = session.createCriteria(PersonForm.class);  //定义Criteria对象
String[] arr ={"大专","本科","研究生"};  //定义查询字符串对象
criteria.add(Restrictions.not(Restrictions.in("knowledge",arr)));  //查询学历不为指定字符串的员工信息
list = criteria.list();  //执行查询语句

本文标题:Hibernate not方法:逻辑非操作

本文地址:https://www.hosteonscn.com/6481.html

评论

0条评论

发表评论

邮箱地址不会被公开。 必填项已用*标注