Skip to content

Commit

Permalink
GRAILS-8821 - docs for first() and last() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Brown committed Sep 6, 2012
1 parent 320956a commit a73dda4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/en/ref/Domain Classes/first.gdoc
@@ -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]

35 changes: 35 additions & 0 deletions src/en/ref/Domain Classes/last.gdoc
@@ -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]


0 comments on commit a73dda4

Please sign in to comment.