Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GRAILS-8821 - docs for first() and last() methods
- Loading branch information
Jeff Brown
committed
Sep 6, 2012
1 parent
320956a
commit a73dda4
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
h1. first | ||
|
||
h2. Purpose | ||
|
||
Retrieves the first instance of the domain class. | ||
|
||
h2. Examples | ||
|
||
Given the domain class: | ||
|
||
{code:java} | ||
class Person { | ||
String firstName | ||
String lastName | ||
Integer age | ||
} | ||
{code} | ||
|
||
{code:java} | ||
// retrieve the first person ordered by the identifier | ||
def p = Person.first() | ||
|
||
// retrieve the first person ordered by the lastName property | ||
p = Person.first(sort: 'lastName') | ||
{code} | ||
|
||
Parameters: | ||
|
||
* @sort@ (optional) - The name of the property to sort by | ||
|
||
See also: | ||
|
||
* [last|domainClasses] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
h1. last | ||
|
||
h2. Purpose | ||
|
||
Retrieves the last instance of the domain class. | ||
|
||
h2. Examples | ||
|
||
Given the domain class: | ||
|
||
{code:java} | ||
class Person { | ||
String firstName | ||
String lastName | ||
Integer age | ||
} | ||
{code} | ||
|
||
{code:java} | ||
// retrieve the last person ordered by the identifier | ||
def p = Person.last() | ||
|
||
// retrieve the last person ordered by the lastName property | ||
p = Person.last(sort: 'lastName') | ||
{code} | ||
|
||
Parameters: | ||
|
||
* @sort@ (optional) - The name of the property to sort by | ||
|
||
See also: | ||
|
||
* [first|domainClasses] | ||
|
||
|