ObjectDB ObjectDB

getPersistenceManagerFactory(overrides, name, resourceLoader, pmfLoader) - JDO JDOHelper's static method

Static Method
javax.jdo.JDOHelper
PersistenceManagerFactory getPersistenceManagerFactory(
  Map overrides,
  String name,
  ClassLoader resourceLoader,
  ClassLoader pmfLoader
)

Returns a PersistenceManagerFactory configured based on the properties stored in the resource at name, or, if not found, returns a PersistenceManagerFactory with the given name or, if not found, returns a javax.persistence.EntityManagerFactory cast to a PersistenceManagerFactory. If the name given is null or consists only of whitespace, it is interpreted as Constants.ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME. The following are standard key names:
"javax.jdo.PersistenceManagerFactoryClass"
"javax.jdo.option.Optimistic",
"javax.jdo.option.RetainValues",
"javax.jdo.option.RestoreValues",
"javax.jdo.option.IgnoreCache",
"javax.jdo.option.NontransactionalRead",
"javax.jdo.option.NontransactionalWrite",
"javax.jdo.option.Multithreaded",
"javax.jdo.option.ConnectionUserName",
"javax.jdo.option.ConnectionPassword",
"javax.jdo.option.ConnectionURL",
"javax.jdo.option.ConnectionFactoryName",
"javax.jdo.option.ConnectionFactory2Name",
"javax.jdo.option.Mapping",
"javax.jdo.mapping.Catalog",
"javax.jdo.mapping.Schema",
"javax.jdo.option.PersistenceUnitName".
"javax.jdo.option.DetachAllOnCommit".
"javax.jdo.option.CopyOnAttach".
"javax.jdo.option.TransactionType".
"javax.jdo.option.ServerTimeZoneID".
"javax.jdo.option.Name".
and properties of the form
javax.jdo.option.InstanceLifecycleListener.{listenerClass}[=[{pcClasses}]] where {listenerClass} is the fully qualified name of a class that implements javax.jdo.listener.InstanceLifecycleListener, and {pcClasses} is an optional comma- or whitespace-delimited list of persistence-capable classes to be observed; the absence of a value for a property of this form means that instances of all persistence-capable classes will be observed by an instance of the given listener class.

JDO implementations are permitted to define key values of their own. Any key values not recognized by the implementation must be ignored. Key values that are recognized but not supported by an implementation must result in a JDOFatalUserException thrown by the method.

The returned PersistenceManagerFactory is not configurable (the setXXX methods will throw an exception). This method loads the properties found at name, if any, via resourceLoader, and creates a PersistenceManagerFactory with pmfLoader. Any exceptions thrown during resource loading will be wrapped in a JDOFatalUserException. If multiple PMFs with the requested name are found, a JDOFatalUserException is thrown.

Parameters:
overrides - a Map containing properties that override properties defined in any resources loaded according to the "name" parameter
name - interpreted as the name of the resource containing the PMF properties, the name of the PMF, or the persistence unit name, in that order; if name is null, blank or whitespace, it is interpreted as indicating the anonymous PersistenceManagerFactory.
resourceLoader - the class loader to use to load properties file resources; must be non-null if name is non-null or blank
pmfLoader - the class loader to use to load the PersistenceManagerFactory or javax.persistence.EntityManagerFactory classes
Returns:
the PersistenceManagerFactory with properties in the given resource, with the given name, or with the given persitence unit name
Since:
JDO 2.1
See Also:
Constants.ANONYMOUS_PERSISTENCE_MANAGER_FACTORY_NAME