Grid with nested property


I have 2 classes, Person and Company. Person has a relationship “ManyToOne” to Company.

Now I wanted to show all persons in a grid with one column for the name of company. When I set the columns of my grid like that I get an NullPointerException:

getGrid().setColumns("name", "firstname",""); When I just use “company” instead of “” it works, but then I get the identifier of the object.

Hope you can help me. Thanks.


My understanding is that you should get illegal argument exceptiomn instead, since both “name” and “” are ending with “name”, which will be used as identifier and will be a conflict.

Yes, your are right. I solved it now like that:

getGrid().addColumn(person -> person.getCompany() == null ? "": person.getCompany().getName()).setCaption("Company Name").setId("companyName");
getGrid().setColumns("name", "firstname", "companyName");