Frage

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" ])

War es hilfreich?

Lösung

Product.findAllByNameIlike("%$params.name%",[order: "desc" ])?.collect{it.name}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top