Bug 326658 - CursoredStream.getSize doesn't supports group-by-clause
Summary: CursoredStream.getSize doesn't supports group-by-clause
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 07:30 EDT by Georg CLA
Modified: 2022-06-09 10:03 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 Georg CLA 2010-09-30 07:30:14 EDT
Build Identifier: v20091127-r5931

I have a class Person, which could have historic data, so for one person and id, i can have more than one entry in a table PERSON (this table is mapped to the calss Person).

I define a ReportQuery to a Class Person like this:

ExpressionBuilder aBuilder = new ExpressionBuilder();
ReportQuery aReportQuery = new ReportQuery(aBuilder);
aReportQuery.setReferenceClass(Person.class);
aReportQuery.useCursoredStream();
...

After that, i define some attributes for selection. some of them, i also define in a group-by-clause.

The origin SQL is like this:
SELECT name, id from PERSON where name like 'A%' order by name, id group by name,  id

I use the group-by-clause to get only one entry for the combination name, id (a distinct clause could also do this, but i used the group-by-clause).

After executing the sql
...
getClientSession().executeQuery(aReportQuery);
...
i get a CursoredStream. I get the expected size from the cursor with cursoredStream.size(), which called CursoredStream.getCursorSize();
This method doesn't supports the group-by-clause. So, the generated SQL looks like this:
SELECT count(id) from PERSON where name like 'A%'


Reproducible: Always

Steps to Reproduce:
1. Build an expression for a ReportQuery with a group-by-clause
2. Execute the reportQuery an log the SQLs
3. Get the expected size from the cursored stream and have a look at the logged SQL
Comment 1 Georg CLA 2010-09-30 07:33:22 EDT
This also could be a bug since toplink 9:

http://programming.itags.org/development-tools/63010/
Comment 2 Tom Ware CLA 2010-10-14 13:24:27 EDT
Setting target and priority.  See the following page for details of the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:03:00 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink