look for json key's value in jsonb
look for json key's value in jsonb
i am using criteriabuilder of jpa and i want to look for a value of a json field in a jsonb column.
the jsonb looks like this :
[{"field1":"value1","field2":"value2"},{"field3":"value3","field4":"value4"}]
i started creating my predicates but i got errors.
predicates.add( builder.like(
builder.function("JSON_EXTRACT", String.class, root1.get("jsonBColumn"),
builder.literal(""value3"")), "%" + searchValue + "%"));
the error i am getting is
org.postgresql.util.PSQLException: ERROR: function json_extract(jsonb,
character varying) does not exist Hint: No function matches the given
name and argument types. You might need to add explicit type casts.
Can anybody help ?
ok i did format my post
– M.Simon
8 mins ago
And did you read the error message? "json_extract" doesn't exist, from your database. So perhaps, just perhaps there is no such function with that name. postgresql.org/docs/9.6/static/functions-json.html
– Billy Frost
4 mins ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Here's an idea. Format your post so that it is half readable ...
– Billy Frost
8 hours ago