Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331352 - Comparing object using is not null results in an Exception
Summary: Comparing object using is not null results in an Exception
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-29 11:10 EST by Vikram Bhatia CLA
Modified: 2022-06-09 10:35 EDT (History)
2 users (show)

See Also:


Attachments
Proposed Fix (6.40 KB, patch)
2010-11-29 11:19 EST, Vikram Bhatia CLA
david.minsky: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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