Book
.findAll(
"
from Book as b where b.author=?
"
, [
'
Dan Brown
'
])
Book
.findAll(
"
from Book as b where b.author=? order by b.releaseDate
"
,
[
'
Dan Brown
'
], [
max
:
10
,
offset
:
5
])
def
query =
"
from Book as b where b.author='Dan Brown' order by b.releaseDate
"
Book
.findAll(query, [
max
:
10
])
Book
.findAll(query, [
max
:
10
,
offset
:
5
])
Book
.findAll(
"
from Book as b where b.author=:author
"
,
[
author
:
'
Dan Brown
'
])
Book
.findAll(
"
from Book as b where b.author=:author
"
,
[
author
:
'
Dan Brown
'
], [
max
:
10
,
offset
:
5
])
Book
.findAll(
"
from Book as b where b.author in (:authors)
"
,
[
authors
: [
'
Dan Brown
'
,
'
Jack London
'
]])
Book
.findAll(
"
from Book as b where not exists
"
+
"
(from Borrow as br where br.book = b)
"
)
def
example =
new
Book
(
author
:
"
Dan Brown
"
)
Book
.findAll(example)
def
results = Person.findAll {
lastName ==
"
Simpson
"
def
results = Person.findAll(
sort
:
"
firstName
"
) {
lastName ==
"
Simpson
"
Book.findAll()
Book.findAll(String query)
Book.findAll(String query, Collection positionalParams)
Book.findAll(String query, Collection positionalParams, Map queryParams)
Book.findAll(String query, Map namedParams)
Book.findAll(String query, Map namedParams, Map queryParams)
Book.findAll(Book example)
Book.findAll(Closure whereCriteria)
Book.findAll(Map queryParams, Closure whereCriteria)
readOnly
-
true
if returned objects should not be automatically dirty-checked (simlar to
read()
)
fetchSize
- number of rows fetched by the underlying JDBC driver per round trip
flushMode
- Hibernate
FlushMode
override, defaults to
FlushMode.AUTO
timeout
- query timeout in seconds