Search code examples
javavaadin8

AddColum with embedded object (Vaadin or just Java skill)


I'd like to insert the property(string) of an embedded object with addColumn.

My code is just :

tarifsLignesGrid.addColumn(TarifsLignes::getProducts).setCaption(TITRE_PRODUITS)

the getProduct return a Product entity in which I'd like to take the name property instead of the toString.


Solution

  • A lot more context would be nice, but I'll take a stab in the dark. Assuming the Product class has a getName() method:

    tarifsLignesGrid.addColumn(t -> t.getProducts().getName()).setCaption(TITRE_PRODUITS)