[hibernate-issues] [Hibernate-JIRA] Created: (JPA-31) Simple JPQL with guarded null Parameter fails with Postgresql

Bernard (JIRA) noreply at atlassian.com
Tue Apr 24 20:54:49 EDT 2012


Simple JPQL with guarded null Parameter fails with Postgresql
-------------------------------------------------------------

                 Key: JPA-31
                 URL: https://hibernate.onjira.com/browse/JPA-31
             Project: Java Persistence API
          Issue Type: Bug
    Affects Versions: 1.0.0
         Environment: HIbernate 4.1.1 final, Postgresql driver 9.1-901-1.jdbc4
            Reporter: Bernard
            Priority: Critical
         Attachments: NullParameterHibernatePostgresMaven.zip

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.






--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list