Is there a better way to create a SQL null
value with CriteriaBuilder
than
criteriaBuilder.quot(criteriaBuilder.literal(0), criteriaBuilder.literal(0))
?
The easiest way is to use the method CriteriaBuilder#nullLiteral()
which does exactly that. Since you need a null Integer, use it with Integer Class:
Expression<Integer> expr = criteriaBuilder.nullLiteral(Integer.class);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With