Class SpringPersistenceUnitInfo

java.lang.Object
org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo
org.springframework.orm.jpa.persistenceunit.SpringPersistenceUnitInfo

public class SpringPersistenceUnitInfo extends MutablePersistenceUnitInfo
Subclass of 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 Details

    • SpringPersistenceUnitInfo

      public SpringPersistenceUnitInfo(LoadTimeWeaver loadTimeWeaver)
      Construct a new SpringPersistenceUnitInfo for custom purposes.
      Parameters:
      loadTimeWeaver - the LoadTimeWeaver to use
    • SpringPersistenceUnitInfo

      public SpringPersistenceUnitInfo(ClassLoader classLoader)
      Construct a new SpringPersistenceUnitInfo for custom purposes.
      Parameters:
      classLoader - the ClassLoader to use
  • Method Details

    • getClassLoader

      public @Nullable ClassLoader 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

      public ClassLoader getNewTempClassLoader()
      This implementation delegates to the LoadTimeWeaver, if specified.
    • asStandardPersistenceUnitInfo

      public jakarta.persistence.spi.PersistenceUnitInfo asStandardPersistenceUnitInfo()
      Expose a standard jakarta.persistence.spi.PersistenceUnitInfo proxy for the persistence unit configuration in this SpringPersistenceUnitInfo instance.

      The returned proxy implements jakarta.persistence.spi.PersistenceUnitInfo (and its extended variant SmartPersistenceUnitInfo) for use with persistence provider bootstrapping. Note that the returned proxy is effectively unmodifiable and cannot be downcast to Mutable/SpringPersistenceUnitInfo.