This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 301741 - JPQL: Some JPQL queries fail or lead to incorrect joins
Summary: JPQL: Some JPQL queries fail or lead to incorrect joins
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-03 14:40 EST by James Sutherland CLA
Modified: 2022-06-09 10:28 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Sutherland CLA 2010-02-03 14:40:19 EST
The following JPQL queries seem to be valid JPQL, but do not work as expected,


select e from Employee e where e.id in (select e.id from Employee x)
-> not yet implemented


select e from Employee e where e in (select x from Employee x)
or,
select e from Employee e where e.address in (select x.address from Employee x)
-> bad SQL, missing expression


select e from Employee e where e.address.id in (select a.id from e.address a)
or,
select e from Employee e where e.address.id in (select e.address.id from Address a where a.id = e.address.id)
-> works, but extra joins used


select a from Address a where exists (select e.firstName from Employee e where e.address = a)
-> translates 1 instead of firstName?


select a from Address a where exists (select e.address from Employee e where e.address = a)
-> translates to 1, and joins address twice
Comment 1 Tom Ware CLA 2010-02-11 10:00:50 EST
Setting target and priority.  See the following page for details of what this
means:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 2 Michael OBrien CLA 2010-08-05 16:34:10 EDT
>See possibly related bug# 318225
Comment 3 Chris Delahunt CLA 2010-11-12 09:47:06 EST
Problems with "select e from Employee e where e in (select x from Employee x)" and "select e from Employee e where e.address in (select x.address from Employee x)"
are described in bug 314025
Comment 4 James Sutherland CLA 2011-11-22 15:25:05 EST
These are mainly ok now except for,

select e from Employee e where e.address.id in (select a.id from e.address a)

This still joins the Employee table twice.
Comment 5 James Sutherland CLA 2012-02-06 14:33:04 EST
Fixed in Hermes

Fixes everything but element collection, which still must join twice.
Comment 6 James Sutherland CLA 2012-04-11 10:41:43 EDT
Fixed in 2.4
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:28:46 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink