blaze-persistence icon indicating copy to clipboard operation
blaze-persistence copied to clipboard

Automatic CASE WHEN wrapping of boolean expressions

Open Mobe91 opened this issue 8 years ago • 3 comments

We should add support for plain boolean expressions in entity view mappings like e.g.:

@Mapping("age > 10")

Since JPQL does not support plain boolean expressions in select items, the user currently needs to manually formulate such mappings as CASE WHEN:

@Mapping("CASE WHEN age > 10 THEN true ELSE false END")

This CASE WHEN wrapping should happen automatically.

Mobe91 avatar Feb 12 '17 17:02 Mobe91

Actually I think we should do this in core already instead. Entity views should not have to change anything and only the final JPQL output should show the transformed expression.

beikov avatar Feb 13 '17 12:02 beikov

Maybe we can also allow boolean expressions such as x OR y without having to write x = true OR y = true.

Mobe91 avatar Apr 06 '17 14:04 Mobe91

Although well aware of this limitation, I recently stumbled upon this again by surprise with a x IN (subquery) expression and a SUM(x) IS NOT NULL NULL expression in the select clause.

jwgmeligmeyling avatar Aug 19 '21 19:08 jwgmeligmeyling