JPAContainer OneToMany and ManyToOne

I would access from two tables some attributes, one realitionship is a OneToMany and another is a ManyToOne

sucheStoffJPAContainer = JPAContainerFactory.make(Dokument.class, Schulung.PERSISTENCE_UNIT);
sucheStoffJPAContainer.addNestedContainerProperty(“stoffID.handelsname”);

sucheStoffJPAContainer.addNestedContainerProperty(“stoffID.stoffID.matnr”);

The ERM and the code of my entities are in the attachment.

22101.pdf (568 KB)

Hi,
sucheStoffJPAContainer.addNestedContainerProperty(“stoffID.matnr”); will add a list of Matnr
One Stoff has many Matnr’s, but apparently you only want one ? which one ?
If you want to display the required Matnr in a grid column, you could use GeneratedPropertyContainer

Cheers,
Koenraad

When I add this:
sucheStoffJPAContainer.addNestedContainerProperty(“stoffID.matnr”);

I get the following error:
SCHWERWIEGEND:

java.lang.IllegalArgumentException: Invalid property name
at com.vaadin.addon.jpacontainer.PropertyList.getNestedProperty(PropertyList.java:399)
at com.vaadin.addon.jpacontainer.PropertyList.addNestedProperty(PropertyList.java:250)

No I want to see every matnr, I have made a samll example see attachment

With SQL Container an FreeformQuery I got this result, but it is not lazy and i have not the option to filtering the vaadin FilterTable
22102.pdf (460 KB)

Have anybody an idea?

I find this one:
https://vaadin.com/directory#!addon/jpa-criteria-lazy-container

But it doesn’t support vaadin 7

The solution is probably just do
stop using JPAContainer
. This kind of issues are just much simpler if you handle JPA stuff separately and just use entities and lists of entities in your Vaadin UI code. And much easier if you use Viritin components that consider java.util.List and basic java beans as first class citizen in components APIs.

cheers,
matti