Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 377586 - Simple JPQL with guarded null Parameter fails with Postgresql
Summary: Simple JPQL with guarded null Parameter fails with Postgresql
Status: RESOLVED WORKSFORME
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 critical with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-24 18:15 EDT by Bernard Missing name CLA
Modified: 2022-06-09 10:09 EDT (History)
1 user (show)

See Also:


Attachments
EclipseLink Postgresql Maven test case in zip file (8.47 KB, application/octet-stream)
2012-04-24 18:19 EDT, Bernard Missing name CLA
no flags Details
EclipseLink HSQL Maven test case in zip file (8.33 KB, application/octet-stream)
2012-04-24 18:23 EDT, Bernard Missing name CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernard Missing name CLA 2012-04-24 18:15:30 EDT
Build Identifier: Eclipse Persistence Services - 2.3.2.v20111125-r10461

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

EclipseLink crashes in case where the parameter value is actually null:

Call: SELECT ID, NAME, region_id FROM CUSTOMERORDER WHERE ((? IS NULL) OR (region_id = ?))
	bind => [null, null]
...
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: integer = character varying
  Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.





Reproducible: Always

Steps to Reproduce:
Please refer to the attached maven test cases. These contain criteria queries that require a JVM argument -javaagent:"C:\Documents and Settings\name\.m2\repository\org\eclipse\persistence\eclipselink\2.3.2\eclipselink-2.3.2.jar" 

Please feel free to remove the criteria queries as they are not needed for this issue.
Comment 1 Bernard Missing name CLA 2012-04-24 18:19:44 EDT
Created attachment 214502 [details]
EclipseLink Postgresql Maven test case in zip file
Comment 2 Bernard Missing name CLA 2012-04-24 18:23:11 EDT
Created attachment 214503 [details]
EclipseLink HSQL Maven test case in zip file

This test case is configured for the HSQL Hypersonic database. Works fine.
Comment 3 Tom Ware CLA 2012-05-15 11:43:29 EDT
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 4 Bernard Missing name CLA 2012-08-19 01:46:14 EDT
Seems to work in 2.4.0

2.4.0 has a new very similar issue 387545:

NamedQuery with null Parameter fails at Runtime with Postgresql
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:09:51 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink