49

I am trying to write a NOT IN constraint using JPA Criteria. I've tried something like this:

builder.not(builder.in(root.get(property1)));

though I know it will not work. In the above syntax, how can I add the collection / list against which property1 that will be checked?

Hash
  • 4,647
  • 5
  • 21
  • 39
P.S.
  • 637
  • 1
  • 6
  • 7

1 Answers1

92

builder.not(root.get({field_name}).in(seqs)) seqs is collection.

javanna
  • 59,145
  • 14
  • 144
  • 125
jYeory
  • 936
  • 7
  • 2