This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 243384 - left operand in IN missing
Summary: left operand in IN missing
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-07 03:09 EDT by Tom Eugelink CLA
Modified: 2022-06-09 10:20 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Eugelink CLA 2008-08-07 03:09:58 EDT
Build ID: 1.0

Steps To Reproduce:
I have a JPQL query that looks like this:
select sol from Sellorderline sol where sol.iArticle in (select a from License l inner join l.iLicenseArticlesWhereIAmLicense la inner join la.iArticle a where l = :license)

The generated SQL looks like this (I've stripped some of the returned fields):
SELECT t1.sellorderlinenr, t1.articlenr, ...,t1.dwhby FROM article t0, sellorderline t1 WHERE ( IN (SELECT DISTINCT t2.articlenr, t2.articletypenr, ..., t2.salestatus FROM license t4, license_article t3, article t2 WHERE ((? = t4.licensenr) AND ((t3.licensenr = t4.licensenr) AND (t2.articlenr = t3.articlenr)))) AND (t0.articlenr = t1.articlenr))

Note the "WHERE ( IN (SELECT"; the left side of the IN is not present.

It turns out you cannot do a entity-in-entity, you need to do attribute-in-attribute. The huge list of fields that the subquery returned is the clue.

not:
... and sol.iArticle in (select a ...

but:
... and sol.iArticle.iArticlenr in (select a.iArticlenr ...

Maybe an error message would be appropriate or supporting this JPQL syntax (although when the entity has non-single-attribute keys, that cannot be done).

More information:
Comment 1 James Sutherland CLA 2011-11-16 10:40:36 EST
Fixed this, it now works, so no error message required.
Comment 2 James Sutherland CLA 2011-11-16 11:25:54 EST
See, Bug#314025
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:15:09 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:20:32 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink