JPAContainer Table complex Object map - how do I use composite objects?

Next step in my on-going education of JPAContainer (and JPA in general) and Vaadin.

Next problem :slight_smile:

I have inherited a pretty complex Entity Model (ERM) that we’re writing a simple Vaadin “view” app to browse through the data … Master / Detail sort of things.

Except, to be polite, this is a fairly non-normalized model. :slight_smile:

One of the main views they want is a table of People showing various attributes – MOST of the attributes they want to see are directly within the Person class itself, and this is working just fine.

However, there are some attributes that are part of a different Class within the Person class itself … Think perhaps an “Address” object within the Person object …

I seem to have the JPA wired correctly (after some work) to get this OneToOne relationship working to get this info – but I can’t for the life of me figure out an “easy” way to get this to show in the resultant table. I have a setVisibleColumns for the table (there are literally 50-60 attributes in the main Person class – most are not desired to see in the list) … but I can’t figure out the syntax to specific fields within the Address class within the Person class.

I tried 2 obvious options…

“address.street_name” and “address().street_name” … both throw an error about a "missing id in the Container – Id “blah” not found …

How do I traverse composite objects within a container to show in a table?


And I finally found the right combination of Google keywords to find the answer! :slight_smile:

Looks like for each component object you want to traverse from the main one, you need to do a

    <someContainerHere>.addNestedContainerProperty( "attribute1.attribute2.blah.blah"  );

And reference that in the VisibleColumns, etc. etc. etc.


For a LOT of nested properties – that could be a pain – but I bet the general use case isn’t to have many of them to do …