KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > persistence > spi > PersistenceProvider


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.spi;
24
25 import java.util.Map JavaDoc;
26 import javax.persistence.EntityManagerFactory;
27 /**
28  * Interface implemented by a persistence provider.
29  * The implementation of this interface that is to
30  * be used for a given {@link javax.persistence.EntityManager} is specified in
31  * persistence.xml file in the persistence archive.
32  * This interface is invoked by the Container when it
33  * needs to create an {@link javax.persistence.EntityManagerFactory}, or by the
34  * Persistence class when running outside the Container.
35  *
36  * @since Java Persistence 1.0
37  */

38 public interface PersistenceProvider {
39
40     /**
41     * Called by Persistence class when an {@link javax.persistence.EntityManagerFactory}
42     * is to be created.
43     *
44     * @param emName The name of the persistence unit
45     * @param map A Map of properties for use by the
46     * persistence provider. These properties may be used to
47     * override the values of the corresponding elements in
48     * the persistence.xml file or specify values for
49     * properties not specified in the persistence.xml.
50     * @return EntityManagerFactory for the persistence unit,
51     * or null if the provider is not the right provider
52     */

53     public EntityManagerFactory createEntityManagerFactory(String JavaDoc emName, Map JavaDoc map);
54
55     /**
56      * Called by the container when an {@link javax.persistence.EntityManagerFactory}
57      * is to be created.
58      *
59      * @param info Metadata for use by the persistence provider
60      * @param map A Map of integration-level properties for use
61      * by the persistence provider. Can be null if there is no
62      * integration-level property.
63      * @return EntityManagerFactory for the persistence unit
64      * specified by the metadata
65      */

66     public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map JavaDoc map);
67 }
68         
69
Popular Tags