apache / apache/grails-core

GORM where{} DetachedCriteria does not support property/projection aliases

Open
#14,350 1 comment 0 reactions 0 assignees View on GitHub
relates-to: gorm relates-to: grails-data-hibernate5
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Grails 5.x and 4.x

It is often necessary to use a sort alias based on a projection. It appears in Query.java the Projection classes do NOT support an alias mapping such that the transformer can alias a defined projection to hibernates alias logic. This , for example, makes it impossible to sort by a countDistinct() property.

Contributor guide

Open the contributing guide

Research direction

Start by reading Query.java and the Projection classes mentioned in the issue, then trace how a where{} DetachedCriteria is transformed into Hibernate aliases. Verify the behavior with a countDistinct() projection and sorting by its alias; done means projection aliases are supported for this case in Grails 4.x and 5.x.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.