Container with Criteria support

Hi, i’m trying use JPAContainer, it’s very good addon, but it doesn’t support JPA Criteria.

I’ve a Flex/Java/HB/Spring project and I would rewrite my UI part in Vaadin.

Can I reuse my Java business logic without rewrite my Criterias in Vaadin Filters?

This is an example of my code:

Is there a container that supports Criteria and if yes , is there an example?

Best Regards

I Just added support to CriteriaQuery on jdal core library and rewrite the vaadin sample using it.

Is still a beta version but you may encouraged to try it.

to set a filter on table do as following:


if you use the ContainerDataSource and


If use the table with external paginator.

If you have mapped models and CriteriaQueries, wrap the CriteriaQuery in JpaCriteraBuilder and configure JpaDao with your model class.

Don’t include pagination or order in Queries, JpaDao already do it for you based on the requested page. Both implementations only load one page
at time.


 page.setPageSize(int size); //  to set the page size, 
 page.setPage(int page) ; // to set the requested page.
 page.setSortName(String propertyPath); // to set the order property  "customer.order.price" for example,
 page.setFilter(Filter filter);  // to set the filter bean
and so on.  

To build the sample code use mvn package and mvn jetty:run to try it.

11729.tgz (27.5 KB)

See the
JPA Criteria LazyQueryContainer

Hi Jean-Francois,
i’m trying your add-on, but I can’t find how to use my Hibernate criteria, TypedQuery,NamedQuery with your container.
Can you help me?

// Actual Code

CriteriaQueryDefinition<Anagrafiche> cqd = new CriteriaQueryDefinition( Anagrafiche.entityManager() , true, 30, Anagrafiche.class);
CriteriaContainer cc = new CriteriaContainer(cqd);
cbDestinatario.setContainerDataSource( cc );	

Types of code to be integrated with criteriacontainer


public static TypedQuery<Anagrafiche> Anagrafiche.findCustomer() {
        EntityManager em = Anagrafiche.entityManager();
        TypedQuery<Anagrafiche> q = em.createQuery("SELECT o FROM Anagrafiche AS o WHERE o.indCli = true", Anagrafiche.class);
        return q;


@NamedQuery(name = "User.userExists_LoginID",
            query = "SELECT user FROM User user " +
            "WHERE user.loginID = :loginID " )


public Criteria getSettoriMerceologici() {
                Criteria crit = dao.getSession().createCriteria(SettoriMerceologici.class);
                crit.addOrder( Order.asc("settoreMerceologico") );
                return crit;

Best Regards

JPA 2.0 has its own notion of Criteria query, which is not the same as Hibernate. The two approaches are similar in spirit, but different in the actual API.

Your original question only mentioned CriteriaQuery, and made reference to JPA, so I made my suggestion.

The JPA Criteria LazyQueryContainer is meant for JPA 2.0 Criteria Query, and not for the Hibernate queries you list. Should you want to use it anyway, there is an example application with several usage patterns. Look for the “defineQuery()” method for examples.

Sorry for the confusion.