Hi I'm trying to understand when my code will actually make a connection to the database. Are the following true?
1) Calling em.getTransaction().commit() or em.close() will connect to the database.
2) Calling em.close() will disconnect from the database.
If I have a web application, and I have only created one EntityManager at start of the application to be used by all users from different locations, and each of these users can make calls to the database, would the EntityManager line up all the requests in series or initiate multiple connections to the database for each of the requests?
From the following posts it appears mixing multi-thread with a JPA provider can be nasty. So would the same thing happen to a web based application?
http://blog.xebia.com/2009/02/07/hibernate-and-multi-threading/