I have the below Postgres query which works fine when run through the psql client -
select id,jbag
from mydb.mytable e
where (e.jbag->'myCodes')::jsonb @> '{"C":"C", "T":"T", "L":"L"}';
However, when I run the query by creating a org.Hibernate.query object, I get an exception similar to this -
org.postgresql.util.PSQLException: ERROR: operator does not exist: jsonb @> character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 144
Please help. I have read the following post about creating a new type and that Hibernate does not support postgres JSON operators -
http://www.thoughts-on-java.org/persist-postgresqls-jsonb-data-type-hibernate/
But is there a simple solution?
Thanks