Package javax.persistence
Class Persistence
- java.lang.Object
-
- javax.persistence.Persistence
-
public class Persistence extends Object
Bootstrap class that provides access to an EntityManagerFactory.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PERSISTENCE_PROVIDER
Deprecated.protected static Set<PersistenceProvider>
providers
Deprecated.
-
Constructor Summary
Constructors Constructor Description Persistence()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static EntityManagerFactory
createEntityManagerFactory(String persistenceUnitName)
Create and return an EntityManagerFactory for the named persistence unit.static EntityManagerFactory
createEntityManagerFactory(String persistenceUnitName, Map properties)
Create and return an EntityManagerFactory for the named persistence unit using the given properties.static PersistenceUtil
getPersistenceUtil()
-
-
-
Field Detail
-
PERSISTENCE_PROVIDER
@Deprecated public static final String PERSISTENCE_PROVIDER
Deprecated.- See Also:
- Constant Field Values
-
providers
@Deprecated protected static final Set<PersistenceProvider> providers
Deprecated.
-
-
Method Detail
-
createEntityManagerFactory
public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName)
Create and return an EntityManagerFactory for the named persistence unit.- Parameters:
persistenceUnitName
- The name of the persistence unit- Returns:
- The factory that creates EntityManagers configured according to the specified persistence unit
-
createEntityManagerFactory
public static EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map properties)
Create and return an EntityManagerFactory for the named persistence unit using the given properties.- Parameters:
persistenceUnitName
- The name of the persistence unitproperties
- Additional properties to use when creating the factory. The values of these properties override any values that may have been configured elsewhere- Returns:
- The factory that creates EntityManagers configured according to the specified persistence unit
-
getPersistenceUtil
public static PersistenceUtil getPersistenceUtil()
- Returns:
- Returns a
PersistenceUtil
instance.
-
-