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

Make JpaSort.unsafe() operational for HQL, EQL, and JPQL. #3187

Closed
wants to merge 2 commits into from

Conversation

gregturn
Copy link
Contributor

@gregturn gregturn commented Oct 5, 2023

To support testing various configurations, I also implemente @HideHibernate, @HideEclipseLink, and @HidePersistenceProviders so that test methods and test classes can verify these classpath checks.

@gregturn
Copy link
Contributor Author

gregturn commented Oct 5, 2023

Considering it's a bug fix and all the new code is package-private (or private), then all the HQL and JPQL parts should be a candidate for backporting, at least to all versions that have query parsing.

However, to do so would ALSO require backporting the PersistenceProvider.isPresent from #3170 (which I'm in favor of).

We have offered this method as a way for people to customize an ORDER BY clause beyond a simple property name. For example, someone could use "LENGTH(firstname)" as a function to order by the length of each row's lastname instead of ordering by the lastname itself.

By using the relevant parser and applying a different visitor, this commit make operational a feature that shows little evidence of ever having worked.

See #3172.
@mp911de mp911de force-pushed the main branch 2 times, most recently from 52ee55f to 61e6d36 Compare October 9, 2024 07:35
@mp911de mp911de self-assigned this Jan 28, 2025
@mp911de mp911de added the type: enhancement A general enhancement label Jan 28, 2025
@mp911de mp911de added this to the 4.0 M2 (2025.1.0) milestone Jan 28, 2025
mp911de pushed a commit that referenced this pull request Jan 28, 2025
…ion.

We now parse JpaSort.unsafe(…) expressions using our Query Parser and translate the parsed tree into a CriteriaQuery Expression except for CAST, TREAT and subqueries.

Closes #3172
Original pull request: #3187
mp911de added a commit that referenced this pull request Jan 28, 2025
Refine temporal literal handling. Update documentation.

See #3172
Original pull request: #3187
@mp911de
Copy link
Member

mp911de commented Jan 28, 2025

That's merged and polished now.

@mp911de mp911de closed this Jan 28, 2025
@mp911de mp911de deleted the issue/gh-3172 branch January 28, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate JpaSort.unsafe(…) used with Specifications to order-by Expression
2 participants