findAllBy*
目的 Purpose
Dynamic method that uses the properties of the domain class to create query method expressions that return all matching instances of the domain class使用例 Examples
Given this domain class:class Book { String title Date releaseDate String author Boolean paperback }
def results = Book.findAllByTitle("The Shining", [max: 10, sort: "title", order: "desc", offset: 100])results = Book.findAllByTitleAndAuthor("The Sum of All Fears", "Tom Clancy")results = Book.findAllByReleaseDateBetween(firstDate, new Date())results = Book.findAllByReleaseDateGreaterThanEquals(firstDate)results = Book.findAllByTitleLike("%Hobbit%")results = Book.findAllByTitleIlike("%Hobbit%") // ignore caseresults = Book.findAllByTitleNotEqual("Harry Potter")results = Book.findAllByReleaseDateIsNull()results = Book.findAllByReleaseDateIsNotNull()results = Book.findAllPaperbackByAuthor("Douglas Adams")results = Book.findAllNotPaperbackByAuthor("Douglas Adams")results = Book.findAllByAuthorInList(["Douglas Adams", "Hunter S. Thompson"])
詳細 Description
GORM supports the notion of Dynamic Finders. The findAllBy*
method finds all the results for the given method expression.パラメータ: Parameters:
metaParams
- AM
ap containing pagination parametersmax
,order
,offset
andsort
and metaParametersreadOnly
,timeout
,fetchSize
, andflushMode
def results = Book.findAllByTitle("The Shining", [max: 10, sort: "title", order: "desc", offset: 100])
LessThan
LessThanEquals
GreaterThan
GreaterThanEquals
Between
Like
Ilike
(i.e. ignorecase like)IsNotNull
IsNull
Not
NotEqual
And
Or
InList