When should EntityManagerFactory instance be created/opened?
问题 Ok, I read bunch of articles/examples how to write Entity Manager Factory in singleton. One of them easiest for me to understand a bit: http://javanotepad.blogspot.com/2007/05/jpa-entitymanagerfactory-in-web.html I learned that EntityManagerFactory (EMF) should only be created once preferably in application scope. And also make sure to close the EMF once it\'s used (?) So I wrote EMF helper class for business methods to use: public class EmProvider { private static final String DB_PU = \