jdaugherty commented on code in PR #15599:
URL: https://github.com/apache/grails-core/pull/15599#discussion_r3138346149


##########
grails-data-hibernate5/docs/src/docs/asciidoc/querying/whereQueries.adoc:
##########
@@ -262,42 +271,60 @@ Operator,Criteria Method,Description
 *<=*,sizeLe,The collection size is less than or equal to
 |===
 
-==== Query Aliases and Sorting
 
-If you define a query for an association an alias is automatically generated 
for the query. For example the following query:
+==== Sorting
+
+Sorting with `where` queries is performed by passing `sort` and (optionally) 
`order` arguments to the `list` method of a <<detachedCriteria,Detached 
Criteria>>.
+
+===== Single-field Sorting
+
+To sort by a single property:
 
 [source,groovy]
 ----
-def query = Pet.where {
-    owner.firstName == "Fred"
+def query = Person.where {
+    firstName == "Jack"
 }
+
+def results = query.list(sort: "firstName")
 ----
 
-Will generate an alias for the `owner` association such as `owner_alias_0`. 
These generated aliases are fine for most cases, but are not useful if you want 
to later sort or use a projection on the results. For example the following 
query will fail:
+By default, sorting is ascending. You can specify the direction explicitly 
using the `order` argument:

Review Comment:
   The reason the alias name is being mentioned here is because you can 
technically call createAlias on these - and if you do with an overlap, it will 
fail to create.



-- 
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