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).

setDefaultPersistenceUnitRootLocation

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.

setPackagesToScan

Set whether to use Spring-based scanning for entity classes in the classpath
instead of using JPA's standard scanning of jar files with persistence.xml
markers in them. In case of Spring-based scanning, no persistence.xml
is necessary; all you need to do is to specify base packages to search here.

Default is none. Specify packages to search for autodetection of your entity
classes in the classpath. This is analogous to Spring's component-scan feature
(ClassPathBeanDefinitionScanner).

setMappingResources

Specify one or more mapping resources (equivalent to &lt;mapping-file&gt;
entries in persistence.xml) for the default persistence unit.
Can be used on its own or in combination with entity scanning in the classpath,
in both cases avoiding persistence.xml.

Note that mapping resources must be relative to the classpath root,
e.g. "META-INF/mappings.xml" or "com/mycompany/repository/mappings.xml",
so that they can be loaded through ClassLoader.getResource.

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 file
does not define DataSource names at all, specify a default DataSource
via the "defaultDataSource" property.

setDefaultDataSource

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.
This variant indicates no special transaction setup, i.e. typical resource-local.

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.

setDefaultJtaDataSource

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.
This variant indicates that JTA is supposed to be used as transaction type.

In JPA speak, a DataSource passed in here will be uses as "jtaDataSource"
on the PersistenceUnitInfo passed to the PersistenceProvider, provided that
none has been registered before.

setLoadTimeWeaver

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).

setResourceLoader

This might be a ResourcePatternResolver, which can be checked
through instanceof ResourcePatternResolver. See also the
ResourcePatternUtils.getResourcePatternResolver method.

Invoked after population of normal bean properties but before an init callback
like InitializingBean's afterPropertiesSet or a custom init-method.
Invoked before ApplicationContextAware's setApplicationContext.

getPersistenceUnitInfo

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).

postProcessPersistenceUnitInfo

The 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.