java.lang.Objectorg.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
All Implemented Interfaces:
LoadTimeWeaverAware, InitializingBean, ResourceLoaderAware, PersistenceUnitManager
Supports standard JPA scanning for persistence.xml files,
with configurable file locations, JDBC DataSource lookup and load-time weaving.
The default XML file location is classpath*:META-INF/persistence.xml,
scanning for all matching files in the class path (as defined in the JPA specification).
DataSource names are by default interpreted as JNDI names, and no load time weaving
is available (which requires weaving to be turned off in the persistence provider).
Juergen - Hoeller2.0 - | Field Summary | ||
|---|---|---|
| public static final String | DEFAULT_PERSISTENCE_XML_LOCATION | Default location of the persistence.xml file:
"classpath*:META-INF/persistence.xml". |
| public static final String | ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION | Default location for the persistence unit root URL: "classpath:", indicating the root of the class path. |
| Method from org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager Summary: |
|---|
| afterPropertiesSet, getDataSourceLookup, getDefaultDataSource, getLoadTimeWeaver, getPersistenceUnitInfo, getPersistenceUnitPostProcessors, obtainDefaultPersistenceUnitInfo, obtainPersistenceUnitInfo, postProcessPersistenceUnitInfo, preparePersistenceUnitInfos, setDataSourceLookup, setDataSources, setDefaultDataSource, setDefaultPersistenceUnitRootLocation, setLoadTimeWeaver, setPersistenceUnitPostProcessors, setPersistenceXmlLocation, setPersistenceXmlLocations, setResourceLoader |
| Methods from java.lang.Object: |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager Detail: |
|---|
|
persistence.xml
against Spring-managed DataSource instances. |
persistence.xml. |
|
This can be used in #postProcessPersistenceUnitInfo implementations, detecting existing persistence units of the same name and potentially merging them. |
|
|
|
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. |
persistence.xml files,
parsing all matching files, configurating and post-processing them.
PersistenceUnitInfos cannot be obtained before this preparation method has been invoked. |
persistence.xml
against Spring-managed DataSource instances.
Default is JndiDataSourceLookup, which resolves DataSource names as JNDI names (as defined by standard JPA). Specify a BeanFactoryDataSourceLookup instance if you want DataSource names to be resolved against Spring bean names. Alternatively, consider passing in a map from names to DataSource instances
via the "dataSources" property. If the |
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.
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. |
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. |
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 |
Such post-processors can, for example, register further entity
classes and jar files, in addition to the metadata read in from
|
persistence.xml files to load.
These can be specified as Spring resource locations and/or location patterns.
Default is "classpath*:META-INF/persistence.xml". |
persistence.xml files to load.
These can be specified as Spring resource locations and/or location patterns.
Default is "classpath*:META-INF/persistence.xml". |
|