JPAContainer: Filtering on one-to-many relationships

It’s clear that JPAContainer can filter on one-to-one and many-to-one relationships as nested properties. Is there a way to apply JPAContainer filters to one-to-many relationships?

Suppose I have
[font=Courier New]

class Person {
int id;
List cars;
}

class Car {
int id;
Person person;
String color;
}

[/font]

Any way I can filter a JPAContainer to show me only those Persons having a blue car?

If not, can anyone suggest a Vaadin best practice here? I was thinking of using JPA directly to query for set of Person ids, then filter the JPA container using Or and Equals filters…although this clearly won’t scale…

just for the records: this should be done by adding a com.vaadin.data.Filter sublass to the JPAContainer

Hi Matthew,

This should do:


persons.addContainerFilter(new Like("cars.color", "blue", false) );

Hi Guys,

Im trying to do this but what im getting is : java.lang.IllegalArgumentException: Illegal attempt to dereference path source [null]
. What should i do?

You need use JoinFilter, see example in java doc of class JoinFilter