I have a table synonyms_table with a jsonb column synonym which is a json array. Entries in this column will look something like this : ["good","nice","awesome"]
I have a query select * from synonyms_table where synonym::jsonb ? 'good';
I want to create this using CriteriaBuilder. How can I do that? Any help will be deeply appreciated.
Specification specification = (root, query, criteriaBuilder) -> {
return criteriaBuilder.equal(criteriaBuilder.function("jsonb_extract_path_text", String.class, root.<String>get("synonym"), criteriaBuilder.literal("synonym")), 'good');
};
But this is not working Getting following error:
Caused by: org.postgresql.util.PSQLException: ERROR: function jsonb_extract_path_text(character varying, character varying) does not exist