EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference

javax.persistence
Class Persistence

java.lang.Object
  extended by javax.persistence.Persistence

public class Persistence
extends java.lang.Object

Bootstrap class that is used to obtain an EntityManagerFactory.

Since:
Java Persistence 1.0

Nested Class Summary
static class Persistence.DefaultProviderResolver
          Default provider resolver class to use when none is explicitly set.
static interface Persistence.ProviderResolver
          Interface used by the Persistence class to obtain all available persistence providers.
 
Field Summary
protected static Persistence.ProviderResolver providerResolver
           
protected static java.util.Set<PersistenceProvider> providers
           
 
Constructor Summary
Persistence()
           
 
Method Summary
static void addProvider(PersistenceProvider provider)
          Dynamically add a provider to the set of available providers.
static EntityManagerFactory createEntityManagerFactory(java.lang.String persistenceUnitName)
          Create and return an EntityManagerFactory for the named persistence unit.
static EntityManagerFactory createEntityManagerFactory(java.lang.String persistenceUnitName, java.util.Map properties)
          Create and return an EntityManagerFactory for the named persistence unit using the given properties.
static Persistence.ProviderResolver getProviderResolver()
          Get the resolver being used to obtain the available providers.
static void removeProvider(java.lang.String providerName)
          Dynamically remove a named provider from the set of available providers.
static void resetProviders()
          Reinitialize to have no providers.
static void setProviderResolver(Persistence.ProviderResolver resolver)
          Set the resolver to an alternate provider resolution strategy (implemented externally).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

providers

protected static java.util.Set<PersistenceProvider> providers

providerResolver

protected static Persistence.ProviderResolver providerResolver
Constructor Detail

Persistence

public Persistence()
Method Detail

getProviderResolver

public static Persistence.ProviderResolver getProviderResolver()
Get the resolver being used to obtain the available providers.

Returns:
The resolver used to obtain all available providers

setProviderResolver

public static void setProviderResolver(Persistence.ProviderResolver resolver)
Set the resolver to an alternate provider resolution strategy (implemented externally). This can be used to override the default resolution strategy.

Parameters:
resolver - The resolver to use when obtaining all available providers

createEntityManagerFactory

public static EntityManagerFactory createEntityManagerFactory(java.lang.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(java.lang.String persistenceUnitName,
                                                              java.util.Map properties)
Create and return an EntityManagerFactory for the named persistence unit using the given properties.

Parameters:
persistenceUnitName - The name of the persistence unit
properties - 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.

addProvider

public static void addProvider(PersistenceProvider provider)
Dynamically add a provider to the set of available providers.


removeProvider

public static void removeProvider(java.lang.String providerName)
Dynamically remove a named provider from the set of available providers.


resetProviders

public static void resetProviders()
Reinitialize to have no providers.


EclipseLink 1.1.1_ 1.1.1.v20090430-r4097 API Reference