I want the query to not return any values. I can't just not query the database, so I would like to add some unreachable conditions for predicates, something like "where 1 <> 1". But CriteriaBuilder.equal () does not allow this. Is there a way to achieve the goal?
Thank.
What about
CriteriaBuilder.notEqual(CriteriaBuilder.literal(1), 1)
, , , , . , JPA- 1 <> 1 SQL, ...
1 <> 1
Javadoc CriteriaBuilder: " ( ). ".
CriteriaBuilder cb.. Predicate itsFalse = cb.disjunction();
SQL , Hibernate 0 = 1. :
:
CriteriaBuilder.isTrue(CriteriaBuilder.literal(Boolean.FALSE));