I am facing following problems in Grails.
Here is my code in which I am trying to get list of all possible data and display it.
def c = Abc.createCriteria()
def results = c.list(){
eq("A", "a")
eq("B", "b")
}
As the results is huge it goes on fetching them and dies. I want to restrict the list fetch or put max size for it.
I tried using maxResults()
but it act as a late filter.
I want to put a
I'm not sure what you mean by a "late filter", but as far as I know the following in a criteria query
maxResults(10)
is identical to
LIMIT 10
in an SQL query. You can verify this by turning on SQL logging. In other words maxResults(X)
will limit the number of records returned by the query itself.