Question

If i use the following

@PersistenceUnit(unitName="mongo")
EntityManagerFactory emf;

EntityManager em = emf.createEntityManager();

Will this annotation make sure that the EntityManagerFactory closes gracefully when application is destroyed?

Was it helpful?

Solution

Yes an injected EntityManagerFactory is automatically closed by the container.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top