JPAContainer + Hibernate Inefficient?

First, this is my first time trying to use JPAContainer and Hibernate (or JPAContainer with anything for that matter) … so I’m probably doing something wrong … :slight_smile:

I have debug / trace turned on in my application – when I load a table using JPAContainer … I noticed that hibernate is doing a LOT of SQL fetches… one per row. The general flow seems to be :

Do a SQL Select Count()

Do a SQL Select top(150) and grab the primary keys …

Iterate over each key and do a SQL Select one row at a time …

This seems pretty darn inefficient … I can’t see a reason why the whole “150” rows can’t be retrieved in one SELECT instead of 150 of them?

What am I missing?



Hi Steve,

Your observations are correct. JPAContainer really does fetch each row individually, which is an initial design flaw. This is why we recommend you use the cached entity providers or add a caching middleware between the database and your application to minimize the impact of the excessive querying.

Using caching the performance is actually not that bad.

There are plans to do something about the shortcomings of JPAContainer, but I can’t really say anything more about that at this point, sorry.

If you need help optimizing performance or anything else relating to Vaadin, we’d be glad to provide it. See our
Pro Account
offerings for details.