This subsection describes the interface definition and the notes on the javax.persistence.EntityManagerFactory interface.
package javax.persistence;
/**
* The EntityManagerFactory interface is used
* to obtain the application-managed EntityManager by the application.
* When the application ends the use of EntityManagerFactory,
* the application must close EntityManagerFactory.
* After EntityManagerFactory is closed,
* all EntityManagers created from EntityManagerFactory are
* treated as closed.
*/
public interface EntityManagerFactory {
/**
* Creates a new EntityManager.
* Whenever this method is invoked, a new EntityManager instance
* is returned.
* The isOpen method of EntityManager returned by this method returns
* true.
* @return New EntityManager
*/
public EntityManager createEntityManager() ;
/**
* A new EntityManager is created by using the specified property
* map.
* Whenever this method is invoked, a new EntityManager instance
* is returned.
* The isOpen method of EntityManager returned by this method returns
* true.
* @param map Map storing the EntityManager properties
* @return New EntityManager
*/
public EntityManager createEntityManager(Map map) ;
/**
* Closes factory and releases all the resources
* stored in factory.
* After factory is closed, if method other than isOpen is invoked,
* IllegalStateException is thrown. The isOpen method returns
* false.
* If EntityManagerFactory is closed, all EntityManagers created
* from factory are also treated as closed.
*/
public void close() ;
/**
* Returns whether factory is open.
* @return True until factory is closed
*/
public boolean isOpen() ;
}