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

Bug 316070

Summary: An extra table alias while querying with model containing ternary relationships
Product: z_Archived Reporter: Sherry Hill <sherry.hill>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: mitesh.meswani, peter.krogh, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
test case none

Description Sherry Hill CLA 2010-06-07 19:08:11 EDT
Build Identifier: 2.1.0.v20100503-r7134

A regression was observed from GlassFish 3.0.1 (uses EclipseLink 2.0.1)
to GlassFish 3.1 (EclipseLink 2.1-M7).   Hope that this can be analyzed
for impact before gates are closed for 2.1.

Here are the details:
An extra table alias is used while querying with model containing ternary
relationships which results in more than required rows returned to user.

Query produced by EL 2.0.1 - SELECT t2.ID, t2.CUSTOMERNAME FROM LINEITEM t0, ORDER_TBL t2, ITEM t1 WHERE ((t1.NAME = ?) AND ((t0.ORDER_ID = t2.ID) AND (t1.ID = t0.lineItems_KEY)))
Query produced by EL 2.1 - SELECT t2.ID, t2.CUSTOMERNAME FROM ITEM t3,     ORDER_TBL t2, ITEM t1, LINEITEM t0 WHERE ((t1.NAME = ?) AND ((t0.ORDER_ID = t2.ID) AND (t1.ID = t0.LINEITEMS_KEY)))

Note that table alias t3 is not required. 

Also see
https://glassfish.dev.java.net/issues/show_bug.cgi?id=12131


Reproducible: Always

Steps to Reproduce:
Attached is a simple test case that reproduces the issue.
To run the test, open jar, edit build.properties to point to your workspace
and test.properties to point to your database and execute "ant run".
Comment 1 Sherry Hill CLA 2010-06-07 19:08:53 EDT
Created attachment 171353 [details]
test case
Comment 2 Tom Ware CLA 2010-06-15 11:14:25 EDT
Setting target and priority.  See the following page for details of the meanings of these:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 3 Peter Krogh CLA 2010-06-15 13:42:22 EDT
This bug was fixed on June 7th.  Revision 7522
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:14:50 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:28:32 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink