Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346917 - Eclipse Link dropping GROUP BY clause when translating Query
Summary: Eclipse Link dropping GROUP BY clause when translating Query
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P2 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-23 19:44 EDT by Jan Marc Hoffmann CLA
Modified: 2022-06-09 10:09 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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