spring-projects / spring-data-jpa

Simplifies the development of creating a JPA-based data access layer.
https://spring.io/projects/spring-data-jpa/
Apache License 2.0
2.98k stars 1.41k forks source link

Fix order by rendering for queries containing UNION #3429

Closed christophstrobl closed 1 month ago

christophstrobl commented 5 months ago

Make sure to append space after order by clause and fix alias detection for wrapped sub select. Also make sure to ignore alias used in subselect so they do not conflict with root ones.

Closes: #3427

christophstrobl commented 4 months ago

we should additionally check the count query creation for UNION.

christophstrobl commented 3 months ago

@schauder @mp911de - care to have another look at this one. Changed the sort transformation so that the provided Sort is now appended after the last query expression.

mp911de commented 1 month ago

Updated the HQL code to apply ordering after the last set operation, EQL did that already.