1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 package javax.persistence; 24 25 import java.util.Map; 26 27 /** 28 * The <code>EntityManagerFactory</code> interface is used 29 * by the application to obtain an application-managed entity 30 * manager. When the application has finished using the entity 31 * manager factory, and/or at application shutdown, the 32 * application should close the entity manager factory. 33 * Once an <code>EntityManagerFactory</code> has been closed, all its entity 34 * managers are considered to be in the closed state. 35 * 36 * @since Java Persistence 1.0 37 */ 38 public interface EntityManagerFactory { 39 40 /** 41 * Create a new EntityManager. 42 * This method returns a new EntityManager instance each time 43 * it is invoked. 44 * The isOpen method will return true on the returned instance. 45 */ 46 EntityManager createEntityManager(); 47 48 /** 49 * Create a new EntityManager with the specified Map of 50 * properties. 51 * This method returns a new EntityManager instance each time 52 * it is invoked. 53 * The isOpen method will return true on the returned instance. 54 */ 55 EntityManager createEntityManager(Map map); 56 57 /** 58 * Close the factory, releasing any resources that it holds. 59 * After a factory instance is closed, all methods invoked on 60 * it will throw an IllegalStateException, except for isOpen, 61 * which will return false. Once an EntityManagerFactory has 62 * been closed, all its entity managers are considered to be 63 * in the closed state. 64 */ 65 void close(); 66 67 /** 68 * Indicates whether or not this factory is open. Returns true 69 * until a call to close has been made. 70 */ 71 public boolean isOpen(); 72 } 73