Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331352

Summary: Comparing object using is not null results in an Exception
Product: z_Archived Reporter: Vikram Bhatia <vikram.jeet.bhatia>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: david.minsky, vikram.jeet.bhatia
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed Fix david.minsky: iplog+

Description Vikram Bhatia CLA 2010-11-29 11:10:07 EST
Build Identifier: 1.2.0

Employee has OneToOneMapping to ParkingSpace with the table EMPLOYEE having the foreign key "PSPACE_ID"  to table PARKING_SPACE (PD="ID)

Query query = em.createQuery("SELECT s FROM ParkingSpace s where s.id in
  (1001, 3001) and s.employee is not null"); 

It throws an Exception.
org.eclipse.persistence.exceptions.QueryException
Exception Description: Object comparison to NULL cannot be used for target
foreign key relationships.  Query on the source primary key instead.
Expression: [
Base examples.model.ParkingSpace]
Mapping: [org.eclipse.persistence.mappings.OneToOneMapping[employee]]

Reproducible: Always

Steps to Reproduce:
Apply patch enclosed with only test changes to class JUnitJPQLUnitTestSuite. Run the test case which will fail with the underlying exception.
Comment 1 Vikram Bhatia CLA 2010-11-29 11:19:31 EST
Created attachment 184046 [details]
Proposed Fix
Comment 2 David Minsky CLA 2010-11-30 16:50:47 EST
Fixed in trunk (2.2) revision: 8588
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:35:49 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink