Use JSONB '->>' function to avoid unnecessary JSON conversion in criteria builders.

Closes #12280
This commit is contained in:
Stefan Guilhen 2022-10-25 11:08:24 -03:00 committed by Hynek Mlnařík
parent c3d53ae6e0
commit 02a69561b5

View file

@ -71,8 +71,8 @@ public class JpaClientModelCriteriaBuilder extends JpaModelCriteriaBuilder<JpaCl
return new JpaClientModelCriteriaBuilder((cb, query, root) ->
cb.equal(
cb.function("->", JsonbType.class, root.get("metadata"), cb.literal("fAlwaysDisplayInConsole")),
cb.literal(convertToJson(value[0])))
cb.function("->>", JsonbType.class, root.get("metadata"), cb.literal("fAlwaysDisplayInConsole")).as(Boolean.class),
value[0])
);
} else if (modelField == SearchableFields.ATTRIBUTE) {
validateValue(value, modelField, op, String.class, String.class);