Question

I have the domain class:

class Product {

    String barcode
    String name
    String measurement

    static constraints = {

    }
}

Now, I want to get a list with only one field like "name":

Product.findAllByNameIlike("%$params.name%",[order: "desc" ])

Était-ce utile?

La solution

Product.findAllByNameIlike("%$params.name%",[order: "desc" ])?.collect{it.name}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top