JPAContainer table view toMany

Hi there!

I’ve a small problem with relationships and JPAContainer in a table. How can i make relations visible? I there a default solution?
Firms have one or many

Table firmsTable = new Table(“Firmenübersicht”,firmaSessionBean.getFirmen());

firmsTable.setVisibleColumns(new String{“name1”,“adresse.name1”} ); ← does not work …
firmsTable.setColumnHeaders(new String{“Name”,“Adresse”});

And how can i do something like that? :

firmsTable.setVisibleColumns(new String{“name1”,getCalculation(getCurrentTableItem())} ); ← is there a way to get the current rendered item to calculate something? Or do i need to implement this in my Bean or @Entity POJO?

Thank you,
Matthias

Hi,

You’ll need to introduce the nested property at container level like this:

jpacontainer.addNestedContainerProperty(“address.street”);

The thingie you are looking for the second task is ColumnGenerator and method addGeneratedColumn in Table.

cheers,
matti

The nested property stuff is also covered by the manual:
https://vaadin.com/book/-/page/jpacontainer.usage.html#jpacontainer.usage.nested-properties