JPAContainer jdbc connection usage

Once one JPAContainer is created like

JPAContainer users = JPAContainerFactory.make(User.class, “persistenceUnitName”);

Now I suppose that the “users” container will use one EntityManager which in turn uses one JDBC connection from the connection pool.

That resource utilization (jdbc Connection attached to EntityManager attached to JPAContainer) happens during the lifetime of the httprequest or the usage of the entityManager/connection has another lifespan ?

Can you please help me understand the gap between one JPAContainer instance and when and how jdbc connections are used through the EntityManager ?

I read the vaadin jpa container tutorial and I don’t find this information there.
Thank you.

Any news please ?

Hi David,

I am looking for the same information. Do you have any updates?

Hi, An old thread but let’s put my 5 cents…

If you are using a pool of connections, the lifespam of each connection depends on your particular pool implementation/configuration. I would say typically, one connection will serve several EntityManagers. Regarding EntityManagers, There are several implementations of EntityProvider and I would say having a look at those might be a good way of understanding the lifespam of the EntityManagers. In any case, you can provide your own EntityManager to JPAContainerFactory and configure any lifespam you prefer for your EntityManager.

I would suggest to have a look at the code. Hope that helps a bit at least :slight_smile: