Does Grails have a domain.find-by ... option ": select" to limit columns like rails?
2 answers
There are no possible parameters for dynamic Grails crawlers to limit the properties returned by the crawler. The best alternative I know is to use criteria-based predictions i.e.
Book.withCriteria {
like 'author', 'Will%'
projections {
property 'title'
property 'author'
}
}
For details see criteria reference
.
+3
source to share
You cannot limit the columns returned when using a dynamic type lookup findBy
. Intead you have to use either a predictive criteria query or an HQL query executed with executeQuery
+1
source to share