Top Description Methods
org.springframework.orm.jpa.persistenceunit

public Interface PersistenceUnitManager

Known Direct Implementers
org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
Imports
jakarta.persistence.spi.PersistenceUnitInfo

Interface that defines an abstraction for finding and managing JPA PersistenceUnitInfos. Used by org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean in order to obtain a jakarta.persistence.spi.PersistenceUnitInfo for building a concrete jakarta.persistence.EntityManagerFactory.

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

Author
Juergen Hoeller
Since
2.0
See Also
DefaultPersistenceUnitManager, org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean#setPersistenceUnitManager

Method Summary

Modifier and TypeMethod and Description
public PersistenceUnitInfo

Returns:

the PersistenceUnitInfo (never null)
obtainDefaultPersistenceUnitInfo
()

Obtain the default PersistenceUnitInfo from this manager.

public PersistenceUnitInfo

Returns:

the PersistenceUnitInfo (never null)
obtainPersistenceUnitInfo
(String
the name of the desired persistence unit
persistenceUnitName
)

Obtain the specified PersistenceUnitInfo from this manager.

Method Detail

obtainDefaultPersistenceUnitInfoback to summary
public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo() throws IllegalStateException

Obtain the default PersistenceUnitInfo from this manager.

Returns:PersistenceUnitInfo

the PersistenceUnitInfo (never null)

Exceptions
IllegalStateException:
if there is no default PersistenceUnitInfo defined or it has already been obtained
obtainPersistenceUnitInfoback to summary
public PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName) throws IllegalArgumentException, IllegalStateException

Obtain the specified PersistenceUnitInfo from this manager.

Parameters
persistenceUnitName:String

the name of the desired persistence unit

Returns:PersistenceUnitInfo

the PersistenceUnitInfo (never null)

Exceptions
IllegalArgumentException:
if no PersistenceUnitInfo with the given name is defined
IllegalStateException:
if the PersistenceUnitInfo with the given name has already been obtained