In this section, you will learn about Hibernate restriction ne() or Restrictions.ne() function with running example, code and its output. Here, we will see the hibernate restrictions ne () method descriptions and its running example.
Restrictions.ne("field_name", value): Hibernate Restrictions.ne() function takes two parameters. First is filedName as table's column name and other one is value which you want to match. It gives you all records which empSal is not equal to given value.
Now, We will see the running example of Restrictions.ne() or ne() function. The following example match the field_name = "empSal" and value = 12000 . It gives you all records which empSal is not qual to 12000.
Hibernate: select this_.emp_id as emp1_0_0_, this_.emp_name as emp2_0_0_, this_.emp_sal as emp3_0_0_, this_.emp_expences as emp4_0_0_ from employee this_ where this_.emp_sal<>?