title: Criteria API find 'NULL'
body: <p>The following is an extract from a larger Criteria Query:</p>
  
  <pre><code>...
  Expression literal = builder.literal((String) "%" + value + "%");
  
  List&lt;Predicate&gt; globalPredicate = new ArrayList&lt;&gt;();
  
  globalPredicate.add(builder.equal(subject.get(Subject_.email), literal));
  
  predicates.add(builder.or(globalPredicate.toArray(new Predicate[globalPredicate.size()])));  
  ...
  </code></pre>
  
  <p>There is a condition that exists where I explicitly want to pass in <code>null</code> and find the <code>Subject_.email</code> who are <code>null</code>. I tried passing in <code>null</code> and found that the criteria API wants a nullLiteral(). I tried conditionally replacing <em>literal</em> with nullLiteral() when it was appropriate but then I get nothing returned at all.</p>
  
  <p>What is the best practice way of creating a query that will match <code>null</code> values for the specified attribute in the DB?</p>