| java.lang.Object org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
Method Summary | |
public void | afterPropertiesSet() | public DataSourceLookup | getDataSourceLookup() Return the JDBC DataSourceLookup that provides DataSources for the
persistence provider, resolving data source names in persistence.xml
against Spring-managed DataSource instances. | public DataSource | getDefaultDataSource() Return the JDBC DataSource that the JPA persistence provider is supposed
to use for accessing the database if none has been specified in
persistence.xml . | public LoadTimeWeaver | getLoadTimeWeaver() Return the Spring LoadTimeWeaver to use for class instrumentation according
to the JPA class transformer contract. | final protected MutablePersistenceUnitInfo | getPersistenceUnitInfo(String persistenceUnitName) Return the specified PersistenceUnitInfo from this manager's cache
of processed persistence units, keeping it in the cache (i.e. | public PersistenceUnitPostProcessor[] | getPersistenceUnitPostProcessors() Return the PersistenceUnitPostProcessors to be applied to each
PersistenceUnitInfo that has been parsed by this manager. | public PersistenceUnitInfo | obtainDefaultPersistenceUnitInfo() | public PersistenceUnitInfo | obtainPersistenceUnitInfo(String persistenceUnitName) | protected void | postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui) Hook method allowing subclasses to customize each PersistenceUnitInfo. | public void | preparePersistenceUnitInfos() Prepare the PersistenceUnitInfos according to the configuration
of this manager: scanning for persistence.xml files,
parsing all matching files, configurating and post-processing them. | public void | setDataSourceLookup(DataSourceLookup dataSourceLookup) Specify the JDBC DataSourceLookup that provides DataSources for the
persistence provider, resolving data source names in persistence.xml
against Spring-managed DataSource instances.
Default is JndiDataSourceLookup, which resolves DataSource names as
JNDI names (as defined by standard JPA). | public void | setDataSources(Map<String, DataSource> dataSources) Specify the JDBC DataSources that the JPA persistence provider is supposed
to use for accessing the database, resolving data source names in
persistence.xml against Spring-managed DataSources. | public void | setDefaultDataSource(DataSource defaultDataSource) Specify the JDBC DataSource that the JPA persistence provider is supposed
to use for accessing the database if none has been specified in
persistence.xml . | public void | setDefaultPersistenceUnitRootLocation(String defaultPersistenceUnitRootLocation) Set the default persistence unit root location, to be applied
if no unit-specific persistence unit root could be determined.
Default is "classpath:", that is, the root of the current class path
(nearest root directory). | public void | setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver) Specify the Spring LoadTimeWeaver to use for class instrumentation according
to the JPA class transformer contract. | public void | setPersistenceUnitPostProcessors(PersistenceUnitPostProcessor[] postProcessors) Set the PersistenceUnitPostProcessors to be applied to each
PersistenceUnitInfo that has been parsed by this manager. | public void | setPersistenceXmlLocations(String[] persistenceXmlLocations) Set the locations of the persistence.xml files to load. | public void | setResourceLoader(ResourceLoader resourceLoader) |
DEFAULT_PERSISTENCE_XML_LOCATION | final public static String DEFAULT_PERSISTENCE_XML_LOCATION(Code) | | Default location of the persistence.xml file:
"classpath*:META-INF/persistence.xml".
|
ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION | final public static String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION(Code) | | Default location for the persistence unit root URL:
"classpath:", indicating the root of the class path.
|
afterPropertiesSet | public void afterPropertiesSet()(Code) | | |
getDataSourceLookup | public DataSourceLookup getDataSourceLookup()(Code) | | Return the JDBC DataSourceLookup that provides DataSources for the
persistence provider, resolving data source names in persistence.xml
against Spring-managed DataSource instances.
|
getDefaultDataSource | public DataSource getDefaultDataSource()(Code) | | Return the JDBC DataSource that the JPA persistence provider is supposed
to use for accessing the database if none has been specified in
persistence.xml .
|
getLoadTimeWeaver | public LoadTimeWeaver getLoadTimeWeaver()(Code) | | Return the Spring LoadTimeWeaver to use for class instrumentation according
to the JPA class transformer contract.
|
getPersistenceUnitInfo | final protected MutablePersistenceUnitInfo getPersistenceUnitInfo(String persistenceUnitName)(Code) | | Return the specified PersistenceUnitInfo from this manager's cache
of processed persistence units, keeping it in the cache (i.e. not
'obtaining' it for use but rather just accessing it for post-processing).
This can be used in
DefaultPersistenceUnitManager.postProcessPersistenceUnitInfo implementations,
detecting existing persistence units of the same name and potentially merging them.
Parameters: persistenceUnitName - the name of the desired persistence unit the PersistenceUnitInfo in mutable form,or null if not available |
getPersistenceUnitPostProcessors | public PersistenceUnitPostProcessor[] getPersistenceUnitPostProcessors()(Code) | | Return the PersistenceUnitPostProcessors to be applied to each
PersistenceUnitInfo that has been parsed by this manager.
|
obtainDefaultPersistenceUnitInfo | public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo()(Code) | | |
obtainPersistenceUnitInfo | public PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName)(Code) | | |
postProcessPersistenceUnitInfo | protected void postProcessPersistenceUnitInfo(MutablePersistenceUnitInfo pui)(Code) | | Hook method allowing subclasses to customize each PersistenceUnitInfo.
Default implementation delegates to all registered PersistenceUnitPostProcessors.
It is usually preferable to register further entity classes, jar files etc there
rather than in a subclass of this manager, to be able to reuse the post-processors.
Parameters: pui - the chosen PersistenceUnitInfo, as read from persistence.xml .Passed in as MutablePersistenceUnitInfo. See Also: DefaultPersistenceUnitManager.setPersistenceUnitPostProcessors |
setDataSources | public void setDataSources(Map<String, DataSource> dataSources)(Code) | | Specify the JDBC DataSources that the JPA persistence provider is supposed
to use for accessing the database, resolving data source names in
persistence.xml against Spring-managed DataSources.
The specified Map needs to define data source names for specific DataSource
objects, matching the data source names used in persistence.xml .
If not specified, data source names will be resolved as JNDI names instead
(as defined by standard JPA).
See Also: org.springframework.jdbc.datasource.lookup.MapDataSourceLookup |
setDefaultDataSource | public void setDefaultDataSource(DataSource defaultDataSource)(Code) | | Specify the JDBC DataSource that the JPA persistence provider is supposed
to use for accessing the database if none has been specified in
persistence.xml .
In JPA speak, a DataSource passed in here will be uses as "nonJtaDataSource"
on the PersistenceUnitInfo passed to the PersistenceProvider, provided that
none has been registered before.
See Also: javax.persistence.spi.PersistenceUnitInfo.getNonJtaDataSource |
setDefaultPersistenceUnitRootLocation | public void setDefaultPersistenceUnitRootLocation(String defaultPersistenceUnitRootLocation)(Code) | | Set the default persistence unit root location, to be applied
if no unit-specific persistence unit root could be determined.
Default is "classpath:", that is, the root of the current class path
(nearest root directory). To be overridden if unit-specific resolution
does not work and the class path root is not appropriate either.
|
setLoadTimeWeaver | public void setLoadTimeWeaver(LoadTimeWeaver loadTimeWeaver)(Code) | | Specify the Spring LoadTimeWeaver to use for class instrumentation according
to the JPA class transformer contract.
It is not required to specify a LoadTimeWeaver: Most providers will be
able to provide a subset of their functionality without class instrumentation
as well, or operate with their VM agent specified on JVM startup.
In terms of Spring-provided weaving options, the most important ones are
InstrumentationLoadTimeWeaver, which requires a Spring-specific (but very general)
VM agent specified on JVM startup, and ReflectiveLoadTimeWeaver, which interacts
with an underlying ClassLoader based on specific extended methods being available
on it (for example, interacting with Spring's TomcatInstrumentableClassLoader).
NOTE: As of Spring 2.5, the context's default LoadTimeWeaver (defined
as bean with name "loadTimeWeaver") will be picked up automatically, if available,
removing the need for LoadTimeWeaver configuration on each affected target bean.
Consider using the context:load-time-weaver XML tag for creating
such a shared LoadTimeWeaver (autodetecting the environment by default).
See Also: org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver See Also: org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver See Also: org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader |
setPersistenceUnitPostProcessors | public void setPersistenceUnitPostProcessors(PersistenceUnitPostProcessor[] postProcessors)(Code) | | Set the PersistenceUnitPostProcessors to be applied to each
PersistenceUnitInfo that has been parsed by this manager.
Such post-processors can, for example, register further entity
classes and jar files, in addition to the metadata read in from
persistence.xml .
|
setPersistenceXmlLocations | public void setPersistenceXmlLocations(String[] persistenceXmlLocations)(Code) | | Set the locations of the persistence.xml files to load.
These can be specified as Spring resource locations and/or location patterns.
Default is "classpath*:META-INF/persistence.xml".
Parameters: persistenceXmlLocations - an array of Spring resource Stringsidentifying the location of the persistence.xml files to read |
|
|