KamilH
10/26/2022, 3:02 PMWHERE (season = :season OR :season IS NULL)
Is it possible to achieve the same for collection of “ids” (with IN
operator)? The following code doesn’t work, because it generates expected type as Collection<Season?>
instead of Collection<Season>?
and generally it’s not handled properly
WHERE (season IN :season OR :season IS NULL)
To overcome this issue I use the following statement:
WHERE CASE WHEN :seasonIsEmpty THEN TRUE ELSE season IN :season END
and it works great. However it forces me to introduce additional variable (seasonIsEmpty
) which seems not optimal.
I would expect that at least the following code should work:
WHERE CASE WHEN :season IS NULL THEN TRUE ELSE season IN :season END
but it also generates Collection<Season?>
instead of Collection<Season>?
Is there a way to simplify this statement?Dominaezzz
10/26/2022, 6:08 PM