Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiYTkxNmFhZGI1...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-16773?atlOrigin=eyJpIjoiYTkxNm...
) HHH-16773 (
https://hibernate.atlassian.net/browse/HHH-16773?atlOrigin=eyJpIjoiYTkxNm...
) Introduce a Dialect flag for databases that support group by / order by functional
dependency (
https://hibernate.atlassian.net/browse/HHH-16773?atlOrigin=eyJpIjoiYTkxNm...
)
Issue Type: Improvement Affects Versions: 6.2.4 Assignee: Marco Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
) Created: 09/Jun/2023 02:33 AM Fix Versions: 6.3.0 Priority: Major Reporter: Marco
Belladelli (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=637b480...
)
Currenlty, when grouping or ordering by a selected entity valued path we must expand the
expression to all the entity type’s columns to make sure we match what we do for
selections.
For example this query select a from EntityA a group by a would be translated as:
select a.id, a. name , a.another_col
from EntityA a
group by a.id, a. name , a.another_col
Some databases support functional dependency (
https://en.wikipedia.org/wiki/Functional_dependency ) for ordering and grouping, which
would allow us to only use the primary key of the table in group by and order by clauses,
reducing the length of the query and possibly avoiding some edge-case problems.
This JOOQ article (
https://blog.jooq.org/functional-dependencies-in-sql-group-by/ ) lists
some database Dialects which should support this functionality.
(
https://hibernate.atlassian.net/browse/HHH-16773#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16773#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:62413c2 )