java - When should we close the EntityManagerFactory? -


I am very new at ORM. I am just starting to read books and documents about the Java Integration API with being in hibernation.

I was just wondering, Is EntityManagerFactory close to closing jdbc database connection?

Should we stop it every time we release / update / delete or stop? If we do not turn it off, will the database connection be opened?

I was just wondering, closed EntityManagerFactory jdbc database connection Is it like closing?

This is not perfect, but close to EntityManagerFactory will be close to eliminating a whole connection pool. If you want to consider a JDBC connection, then you should think of EntityManager .

Should we stop it every time I release / update / delete or stop it? Creating a EntityManagerFactory is a very expensive operation and should be done once for the lifetime of the application (you close the end of the application In). Therefore, no, you should not turn it off for every continuation / update / removal operation.

EntityManagerFactory is created once for all, and you usually receive a request EntityManager , which closes at the end of the request (

If we do not turn it off, will the database connection open? P>

As indicated as this, Code> EntityManager which is actually linked to a A database connection and in fact closed the EntityManager release JDBC connection That time, return it to the pool).


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -