Query Options
If you pass a structure as the last argument to your dynamic finder/counter call, we will consider that by convention to be your query options.
1
user = entityNew( "User" )
2
.findByLastName( "Majano", { ignoreCase=true, timeout=20 } );
3
4
users = entityNew( "User" )
5
.findAllByLastNameLike( "Ma%", { ignoreCase=false, max=20, offset=15 } );
Copied!
The valid query options are:
    ignorecase : Ignores the case of sort order when you set it to true.
    maxResults : Specifies the maximum number of objects to be retrieved.
    offset : Specifies the start index of the resultset from where it has to start the retrieval.
    cacheable : Whether the result of this query is to be cached in the secondary cache. Default is false.
    cachename : Name of the cache in secondary cache.
    timeout : Specifies the timeout value (in seconds) for the query
    datasource : The datasource to use, it defaults to the application
    sortBy : The HQL to sort the query by
    autoCast : No more casting, let us do auto casting for you
    asStream : Want a stream back instead of the results, no problem!
Here is a more descriptive key set with the types and defaults
1
{
2
ignoreCase : boolean (false)
3
maxResults : numeric (0)
4
offset : numeric (0)
5
cacheable : boolean (false)
6
cacheName : string (default)
7
timeout : numeric (0)
8
datasource : string (defaults)
9
sortBy : hql to sort by,
10
autoCast : boolean (true),
11
asStream : boolean (false)
12
}
Copied!
Last modified 2yr ago
Copy link