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

Bug 346917

Summary: Eclipse Link dropping GROUP BY clause when translating Query
Product: z_Archived Reporter: Jan Marc Hoffmann <exelnet>
Component: EclipselinkAssignee: Project Inbox <eclipselink.orm-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Jan Marc Hoffmann CLA 2011-05-23 19:44:23 EDT
The following example query gets wrongly translated by the query engine.

SELECT p FROM Program p, Channel c WHERE p.channel = c GROUP BY c ORDER BY MAX(p.start) ASC

The translated query is missing the GROUP BY clause.

The same query in regular sql syntax produces correct results.

SELECT p.id FROM PROGRAM p, CHANNEL c WHERE p.channel_id = c.id GROUP BY c.id ORDER BY MAX(p.start) ASC

If I add MAX(p.start) to the SELECT clause it works as expected. p.start is of type java.util.Date.
Comment 1 Tom Ware CLA 2011-05-31 10:08:18 EDT
Is there a mapping between Program and Channel.  If so, does a query like this help?

SELECT p FROM Program p join p.channel c GROUP BY c ORDER BY
MAX(p.start) ASC
Comment 2 Tom Ware CLA 2011-06-09 10:04:35 EDT
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 3 Eclipse Webmaster CLA 2022-06-09 10:09:57 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink