I’m using HQL and have this query
<query name="rule.myRule.query.by.name">
<![CDATA[
FROM rule.myRule as cr
WHERE cr.name LIKE :name
AND cr.type = 'myType'
CASE
WHEN COUNT(cr.childRules) > 0
THEN
cr.childRules LIKE :name
]]>
</query>
I need some help making this query correct. What I want is to have the condition cr.childeRule LIKE :name execute only when the count of cr.childRules >0 .
Where am I wrong ?
should do what you want.