Supplying *{{null}}* parameter to the following query results in *{{PSQLException: ERROR: operator does not exist: bytea = integer}}*
{code:java} Query query = em.createQuery("select m from MyEntity m where (?1 is null or ?1=m.something)"); query.setParameter(1, null); query.getResultList(); {code}
It works with H2 tests, but fails in production with Postgres.
Using named parameter also fixes the problem:
{code:java} Query correct = em.createQuery("select m from MyEntity m where (:e is null or :e=m.something)"); correct.setParameter("e", null); correct.getResultList(); {code}
_Test case attached QueryTypeDetermineTest. java_ java. run it with {{-Pdb=pgsql}} to see failure_ |
|