Last Updated: February 25, 2016
· yunspace

Avoid "?" operator conflict between Postgres JSONB and Hibernate/JDBC

We came across this very issue when using Hibernate to query a JSONB column in Postgres. You want to use the "?" operator to check if the JSONB column contains certain values but Hibernate thinks the "?" is a placeholder for a parameter.

The following stackoverflow answer provides the perfect solution. Overwrite the "?" with a different operator such as "#-#" and use that instead.