Reputation: 1305
Is there a better way to create a SQL null
value with CriteriaBuilder
than
criteriaBuilder.quot(criteriaBuilder.literal(0), criteriaBuilder.literal(0))
?
Upvotes: 9
Views: 6086
Reputation: 16273
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);
Upvotes: 21