Skip to content
Advertisement

Case condition in hql

What I’m trying to achieve with this query is: always do the “mother” conditional, but if there isn’t mother, then do the “dad” conditional, is this posible?

Advertisement

Answer

This query:

will try to join first by matching the column idMother to :idMother.
If this is not possible then a match of idFather to :idFather will be used, if it exists.

This query:

will try to join first by matching the column idMother to :idMother.
If this is not possible then, only if idMother is null, a match of idFather to :idFather will be used, if it exists.

Or maybe you want this:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement