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}
_I could not create a test _Test case because this seems like a Postgres specific bug_ attached QueryTypeDetermineTest.java_ |
|