-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: Query
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Hibernate User Guide relevant section: https://docs.jboss.org/hibernate/stable/orm/userguide/html_single/Hibernate_User_Guide.html#hql-case-expressions
HQL examples:
Flavour #1: simple case expressions
select
case p.nickName
when 'NA' then '<no nick name>'
else p.nickName end
from Person p
Flavour #2: searched case expressions
select
case
when p.nickName = 'NA' then '<no nick name>'
else p.nickName end
from Person p
Note that when ... then ... could show up more than once.
For HQL's CASE expression involving one single when ... then ... usage, it can be represented in MQL using $cond; otherwise $switch might be more appropriate without $cond cascading.