Class SpringPersistenceUnitInfo
MutablePersistenceUnitInfo that adds instrumentation hooks based on
Spring's LoadTimeWeaver abstraction.
As of 7.0, this class is public for custom bootstrapping purposes. A fully configured
SpringPersistenceUnitInfo instance can be turned into a standard JPA descriptor
through asStandardPersistenceUnitInfo() (returning a JPA 3.2/4.0 adapted proxy).
Note: For post-processing within a LocalContainerEntityManagerFactoryBean
bootstrap, the base type MutablePersistenceUnitInfo is entirely sufficient.
- Since:
- 7.0
- Author:
- Rod Johnson, Juergen Hoeller, Costin Leau
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSpringPersistenceUnitInfo(ClassLoader classLoader) Construct a new SpringPersistenceUnitInfo for custom purposes.SpringPersistenceUnitInfo(LoadTimeWeaver loadTimeWeaver) Construct a new SpringPersistenceUnitInfo for custom purposes. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddQualifierAnnotationName(String qualifierAnnotationName) voidaddTransformer(jakarta.persistence.spi.ClassTransformer classTransformer) This implementation delegates to the LoadTimeWeaver, if specified.voidapply(jakarta.persistence.PersistenceConfiguration config, DataSourceLookup dataSourceLookup) Apply the given JPA 3.2PersistenceConfigurationto this persistence unit, copying all applicable settings.voidapply(PersistenceManagedTypes managedTypes) Apply the givenPersistenceManagedTypesto this persistence unit, typically coming from Spring AOT.jakarta.persistence.spi.PersistenceUnitInfoExpose a standardjakarta.persistence.spi.PersistenceUnitInfoproxy for the persistence unit configuration in thisSpringPersistenceUnitInfoinstance.This implementation returns the LoadTimeWeaver's instrumentable ClassLoader, if specified.This implementation delegates to the LoadTimeWeaver, if specified.voidsetScopeAnnotationName(@Nullable String scopeAnnotationName) Methods inherited from class MutablePersistenceUnitInfo
addJarFileUrl, addManagedClassName, addManagedPackage, addMappingFileName, addProperty, excludeUnlistedClasses, getJarFileUrls, getJtaDataSource, getManagedClassNames, getManagedPackages, getMappingFileNames, getNonJtaDataSource, getPersistenceProviderClassName, getPersistenceProviderPackageName, getPersistenceUnitName, getPersistenceUnitRootUrl, getPersistenceXMLSchemaVersion, getProperties, getSharedCacheMode, getTransactionType, getValidationMode, setExcludeUnlistedClasses, setJtaDataSource, setNonJtaDataSource, setPersistenceProviderClassName, setPersistenceProviderPackageName, setPersistenceUnitName, setPersistenceUnitRootUrl, setPersistenceXMLSchemaVersion, setProperties, setSharedCacheMode, setTransactionType, setValidationMode, toString
-
Constructor Details
-
SpringPersistenceUnitInfo
Construct a new SpringPersistenceUnitInfo for custom purposes.- Parameters:
loadTimeWeaver- the LoadTimeWeaver to use
-
SpringPersistenceUnitInfo
Construct a new SpringPersistenceUnitInfo for custom purposes.- Parameters:
classLoader- the ClassLoader to use
-
-
Method Details
-
getClassLoader
This implementation returns the LoadTimeWeaver's instrumentable ClassLoader, if specified. -
addTransformer
public void addTransformer(jakarta.persistence.spi.ClassTransformer classTransformer) This implementation delegates to the LoadTimeWeaver, if specified. -
getNewTempClassLoader
This implementation delegates to the LoadTimeWeaver, if specified. -
setScopeAnnotationName
-
getScopeAnnotationName
-
addQualifierAnnotationName
-
getQualifierAnnotationNames
-
apply
Apply the givenPersistenceManagedTypesto this persistence unit, typically coming from Spring AOT.- Parameters:
managedTypes- the managed persistent types to register- Since:
- 7.0
-
apply
public void apply(jakarta.persistence.PersistenceConfiguration config, DataSourceLookup dataSourceLookup) Apply the given JPA 3.2PersistenceConfigurationto this persistence unit, copying all applicable settings.Beyond the standard
PersistenceConfigurationsettings, "rootUrl" and "jarFileUrls" fromHibernatePersistenceConfigurationare also detected and applied.- Parameters:
config- the JPA persistence configuration to applydataSourceLookup- the JDBC DataSourceLookup that provides DataSources for the persistence provider, resolving data source names inPersistenceConfigurationagainst Spring-managed DataSource instances- Since:
- 7.0
-
asStandardPersistenceUnitInfo
public jakarta.persistence.spi.PersistenceUnitInfo asStandardPersistenceUnitInfo()Expose a standardjakarta.persistence.spi.PersistenceUnitInfoproxy for the persistence unit configuration in thisSpringPersistenceUnitInfoinstance.The returned proxy implements
jakarta.persistence.spi.PersistenceUnitInfo(and its extended variantSmartPersistenceUnitInfo) for use with persistence provider bootstrapping. Note that the returned proxy is effectively unmodifiable and cannot be downcast toMutable/SpringPersistenceUnitInfo.
-