Bug 534802 - Wrong SQL generation when using CriteriaBuilder with distinct option and ordering by custom field
Summary: Wrong SQL generation when using CriteriaBuilder with distinct option and orde...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 critical with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-17 05:20 EDT by Sergey Sazonov CLA
Modified: 2022-06-09 10:02 EDT (History)
0 users

See Also:


Attachments
Sampe application (54.61 KB, application/x-zip-compressed)
2018-05-17 05:20 EDT, Sergey Sazonov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey Sazonov CLA 2018-05-17 05:20:23 EDT
Created attachment 274076 [details]
Sampe application

For example we have SomeEntity and query that selects whole entity and a custom field. We order the query by that custom field. Generated SQL will contain custom field twice and cause SQL error like this:

SELECT DISTINCT ID, NAME, coalesce(ID, ?), coalesce(ID, ?) FROM SAMPLEOBJECT ORDER BY coalesce(ID, ?) ASC

Attached you will find a sample application that reproduces this bug.

Affected versions are 2.6.x, 2.7.x, 3.x.x.
Comment 1 Sergey Sazonov CLA 2018-05-29 05:21:20 EDT
Is anybody reading this?
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:02:28 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink