borinquenkid commented on code in PR #16696:
URL: https://github.com/apache/grails-core/pull/16696#discussion_r4354470095


##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/QueryPathContext.groovy:
##########
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2024-2025 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.grails.orm.hibernate.query
+
+import jakarta.persistence.criteria.Expression
+import jakarta.persistence.criteria.From
+import jakarta.persistence.criteria.Path
+
+/**
+ * What a criterion or order handler sees of the query it converts for: the 
root of the query and the resolution
+ * of property paths the way the built-in criteria resolve them. {@code 
alias.property}, for an alias created with
+ * {@code createAlias}, or {@code association.property} becomes a path on the 
join GORM created for that
+ * association, so a custom criterion and a built-in one on the same 
association restrict the same row rather
+ * than each joining the association again.
+ *
+ * @since 10.0
+ */
+interface QueryPathContext {
+
+    /**
+     * @return the root of the query or subquery the handler converts for
+     */
+    From<?, ?> getRoot()
+
+    /**
+     * @param path a property path: {@code property}, {@code 
association.property} or {@code alias.property}
+     * @return the path, or {@code null} when the property path resolves to an 
expression that is not a path
+     */
+    Path<?> getFullyQualifiedPath(String path)
+
+    /**

Review Comment:
   Done in a1f6687423 (and 1e47f7ed5d on #16733): `QueryPathContext` exposes 
`getSelectionAlias(String)`, which `JpaQueryContext` already implemented, so a 
handler orders by the expression a `sqlProjection` records under its alias; 
predicate property resolution is untouched. 
`HibernateCriteriaBuilderSqlProjectionSpec` orders by a `sqlProjection` alias 
through a handler and asserts the rows come in the projection's order and that 
the SQL orders by the select item (`order by 1 desc`), not by a column. On the 
`no ci` point: the description was stale and is rewritten; this is the merge-up 
of #16733, which runs full CI on 8.1.x, and the label comes off here for a run 
before merge.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to