Hibernation criteria: why is there no Subqueries.isNull (DetachedCriteria)?

I want to translate the script as follows in the criteria:

SELECT ...
FROM A
WHERE 
  A.some_date > (select bdate from B where ...)
  OR (select bdate from B where ...) IS NULL

So A must be returned if either A.Some_date> B.bdate, or if B.bdate is NULL.

I expected that there would be Subqueries.notNull(DetachedCriteria)(for example, there SubQueries.notExists(DetachedCriteria)), but this method does not exist, and I did not find anything else to remove this.

I could, of course, get around this by returning the counter and checking that it is> 0 or such, but then I need to write 2 identical (except for Projection) DetachedCriteria.

Does anyone know if / how to get a NULL check for the above case or why it is not specified in the Hibernate API? There may be a good reason ...

+3
source share
1

,

Subqueries.eq(null, yourDetachedCriteria)

.

0

All Articles