Normally, a JPAContainer
contains all instances of a
particular entity type in the persistence context. Hence, it is equivalent to
a database table or query. Just like with database queries, you often want to
narrow the results down. JPAContainer
implements the
Filterable
interface in Vaadin containers,
described in Section 9.4.4, “Filterable
Containers”. All filtering is
done at the database level with queries, not in the container.
For example, let us filter all the people older than 117:
Filter filter = new Compare.Greater("age", 117); persons.addContainerFilter(filter);
This would create a JPQL query somewhat as follows:
SELECT id FROM Person WHERE (AGE > 117)
The filtering implementation uses the JPA 2.0 Criteria API transparently. As
the filtering is done at the database-level, custom filters that use the
Filterable
API do not work.
When using Hibernate, note that it does not support implicit joins. See Section 18.9.3, “Joins in Hibernate vs EclipseLink” for more details.