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

Bug 337115

Summary: Column alias missing when using fetch groups with join fetching
Product: z_Archived Reporter: attila Mising name <mathe_attila>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: tinhol, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description attila Mising name CLA 2011-02-14 08:30:38 EST
Build Identifier: 

When using fetchgroup in a query with fetch joins, the generated sql statement does not add an alias to the columns ( Eclipselink 2.1.x, 2.2.x )

http://www.eclipse.org/forums/index.php?t=msg&th=203745&start=0&S=27fd1e9fec30586b7d9c95e5310db969
 


Reproducible: Always
Comment 1 Tom Ware CLA 2011-02-24 08:30:17 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Eugene Degtyarjov CLA 2015-10-15 07:56:29 EDT
Hello,

I have reproduced the bug on version 2.6.0

I think, I know how to fix it.

If you look at org.eclipse.persistence.expressions.Expression#writeField method, you see the following

//bug6070214: unique field aliases need to be generated when required.
        if (statement.getUseUniqueFieldAliases()){
            printer.printString(" AS " + statement.generatedAlias(field.getNameDelimited(printer.getPlatform())));
        }

This code adds unique alias for the field. It looks fine, but the org.eclipse.persistence.expressions.Expression#writeField method is overriden in subclass org.eclipse.persistence.internal.expressions.FieldExpression. The subclass does not have the above logic in it, so it does not add aliases to fields from fetch group.

So if you add the above logic to org.eclipse.persistence.internal.expressions.FieldExpression#writeField - sql contains the appropriate aliases.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:27:01 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink