Skip to content

Package: PersistenceProvider

PersistenceProvider

Coverage

1: /**
2: * Copyright (C) 2022 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.model;
16:
17: import java.util.Map;
18:
19: /**
20: * Interface implemented by the persistence provider.
21: * <p>
22: * It is invoked by the container in Java EE environments and by the Persistence class in Java SE environments to create
23: * an EntityManagerFactory and/or to cause schema generation to occur.
24: */
25: public interface PersistenceProvider {
26:
27: /**
28: * Called by Persistence class when an EntityManagerFactory is to be created.
29: *
30: * @param emName the name of the persistence unit
31: * @param map a Map of properties for use by the persistence provider. These properties specify storage
32: * connection configuration and may also specify additional configuration.
33: * @return EntityManagerFactory for the persistence unit, or null if the provider is not the right provider.
34: */
35: EntityManagerFactory createEntityManagerFactory(String emName, Map<String, String> map);
36:
37: // TODO JPA 2.0
38: // public EntityManagerFactory
39: // createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map);
40:
41: /**
42: * Return the utility interface implemented by the persistence provider.
43: *
44: * @return ProviderUtil interface
45: */
46: ProviderUtil getProviderUtil();
47: }