We're updating the issue view to help you get more done. 

Simple JPQL with guarded null Parameter fails with Postgresql

Description

The attached tests contain a case that is similar to

http://en.wikipedia.org/wiki/Java_Persistence_Query_Language#Examples

that shows a JPQL query as follows:

like SELECT a FROM Author a WHERE :lastName IS NULL OR LOWER(a.lastName) =
:lastName

Hibernate crashes in cases where the parameter values are null:

ERROR: operator does not exist: character varying = bytea
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.

The message originating from the engine or driver are not helpful because JPQL does not support type casts.

I think the times are over where on application level one had to code different queries depending on whether a parameter value was null or not.

Environment

HIbernate 4.1.1 final, Postgresql driver 9.1-901-1.jdbc4

Status

Assignee

Unassigned

Reporter

b

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Affects versions

1.0.0

Priority

Critical