org.springframework.orm.jpa.persistenceunit

## Interface PersistenceUnitManager

- All Known Implementing Classes:
    DefaultPersistenceUnitManager

      public interface PersistenceUnitManager

  Interface that defines an abstraction for finding and managing JPA PersistenceUnitInfos. Used by `LocalContainerEntityManagerFactoryBean` in order to obtain a `PersistenceUnitInfo` for building a concrete `EntityManagerFactory`.

  Obtaining a PersistenceUnitInfo instance is an exclusive process. A PersistenceUnitInfo instance is not available for further calls anymore once it has been obtained.

  Since:
    2.0
  Author:
    Juergen Hoeller
  See Also:
    `DefaultPersistenceUnitManager`, `LocalContainerEntityManagerFactoryBean.setPersistenceUnitManager(org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager)`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PersistenceUnitInfo` | `obtainDefaultPersistenceUnitInfo()` Obtain the default PersistenceUnitInfo from this manager.
    `PersistenceUnitInfo` | `obtainPersistenceUnitInfo(String persistenceUnitName)` Obtain the specified PersistenceUnitInfo from this manager.

- - ### Method Detail

    - #### obtainDefaultPersistenceUnitInfo

          PersistenceUnitInfo obtainDefaultPersistenceUnitInfo()
                                                               throws IllegalStateException

      Obtain the default PersistenceUnitInfo from this manager.
      Returns:
        the PersistenceUnitInfo (never `null`)
      Throws:
        `IllegalStateException` - if there is no default PersistenceUnitInfo defined or it has already been obtained

    - #### obtainPersistenceUnitInfo

          PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName)
                                                        throws IllegalArgumentException,
                                                               IllegalStateException

      Obtain the specified PersistenceUnitInfo from this manager.
      Parameters:
        `persistenceUnitName` - the name of the desired persistence unit
      Returns:
        the PersistenceUnitInfo (never `null`)
      Throws:
        `IllegalArgumentException` - if no PersistenceUnitInfo with the given name is defined
        `IllegalStateException` - if the PersistenceUnitInfo with the given name has already been obtained