Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync requirements for sorting with JPQL #627

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

gavinking
Copy link
Contributor

this is a traditional restriction on the 'order by' clause

see section 4.10 of latest JPA 3.2 specification

this is a traditional restriction on the 'order by' clause

see section 4.10 of latest JPA 3.2 specification
Copy link
Contributor

@njr-11 njr-11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clears up an issue that I tried to raise while reviewing the JDQL pull. I remember asking about the order of evaluation of the clauses and how SELECT could be done before ORDER BY when SELECT might restrict the available entity attributes such that some aren't available for ORDER BY to sort on. What you added in this pull causes the section that I was asking about to make more sense now.

spec/src/main/asciidoc/query-language.asciidoc Outdated Show resolved Hide resolved
Co-authored-by: Nathan Rauh <nathan.rauh@us.ibm.com>
@gavinking
Copy link
Contributor Author

This clears up an issue that I tried to raise while reviewing the JDQL pull. I remember asking about the order of evaluation of the clauses and how SELECT could be done before ORDER BY when SELECT might restrict the available entity attributes such that some aren't available for ORDER BY to sort on. What you added in this pull causes the section that I was asking about to make more sense now.

OK, cool, yes, I remember the discussion. And yeah, strictly-speaking you're right that if projection happens before sorting then you can't sort by columns which are projected away. In actually practice I ignore this restriction all the time with no ill effects. But here we should be more careful.

@otaviojava otaviojava merged commit d5f7bcd into jakartaee:main Apr 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants