Skip to content

Commit

Permalink
Merge branch 'mine'
Browse files Browse the repository at this point in the history
  • Loading branch information
pledbrook committed Aug 24, 2010
2 parents cefe8b7 + 589df2b commit 90bc122
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/ref/Domain Classes/createCriteria.gdoc
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,24 @@ sqlRestriction "char_length( first_name ) = 4"
{code}
{table}

With dynamic finders, you have access to options such as 'max', 'sort', etc. These are available to criteria queries as well, but they are named differently:

{table}
Name | Description | Example
*order*(string, string) | Specifies both the sort column (the first argument) and the sort order (either 'asc' or 'desc'). | {code}
order "age", "desc"
{code}
*firstResult*(int) | Specifies the offset for the results. A value of 0 will return all records up to the maximum specified. | {code}
firstResult 20
{code}
*maxResults*(int) | Specifies the maximum number of records to return. | {code}
maxResults 10
{code}
*cache*(boolean) | Tells Hibernate whether to cache the query or not (if the query cache is enabled). | {code}
cache true
{code}
{table}

Criteria also support the notion of projections. A projection is used to change the nature of the results. For example the following query using a projection to count the number of distinct @branch@ names there are for each @Account@:

{code:java}
Expand Down Expand Up @@ -159,4 +177,4 @@ sum("balance"){code}
*rowCount* | Returns count of the number of rows returned | {code:java}
rowCount(){code}

{table}
{table}

0 comments on commit 90bc122

Please sign in to comment.