Top Description Methods
org.springframework.orm.jpa

public Interface EntityManagerFactoryInfo

Known Direct Implementers
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean
Imports
java.util.Map, javax.sql.DataSource, jakarta.persistence.EntityManager, .EntityManagerFactory, jakarta.persistence.spi.PersistenceProvider, .PersistenceUnitInfo, org.springframework.lang.Nullable

Metadata interface for a Spring-managed JPA EntityManagerFactory.

This facility can be obtained from Spring-managed EntityManagerFactory proxies through casting the EntityManagerFactory handle to this interface.

Authors
Rod Johnson, Juergen Hoeller
Since
2.0

Method Summary

Modifier and TypeMethod and Description
public EntityManager
createNativeEntityManager(Map<?, ?> properties)

Create a native JPA EntityManager to be used as the framework-managed resource behind an application-level EntityManager handle.

public ClassLoader
getBeanClassLoader()

Return the ClassLoader that the application's beans are loaded with.

public DataSource

Returns:

the JDBC DataSource, or null if not known
getDataSource
()

Return the JDBC DataSource that this EntityManagerFactory obtains its JDBC Connections from.

public Class<? extends EntityManager>
getEntityManagerInterface()

Return the (potentially vendor-specific) EntityManager interface that this factory's EntityManagers will implement.

public JpaDialect
getJpaDialect()

Return the vendor-specific JpaDialect implementation for this EntityManagerFactory, or null if not known.

public EntityManagerFactory

Returns:

the unadorned EntityManagerFactory (never null)
getNativeEntityManagerFactory
()

Return the raw underlying EntityManagerFactory.

public PersistenceProvider

Returns:

the PersistenceProvider used to create this EntityManagerFactory, or null if the standard JPA provider autodetection process was used to configure the EntityManagerFactory
getPersistenceProvider
()

Return the underlying PersistenceProvider that the underlying EntityManagerFactory was created with.

public PersistenceUnitInfo

Returns:

the PersistenceUnitInfo used to create this EntityManagerFactory, or null if the in-container contract was not used to configure the EntityManagerFactory
getPersistenceUnitInfo
()

Return the PersistenceUnitInfo used to create this EntityManagerFactory, if the in-container API was used.

public String
getPersistenceUnitName()

Return the name of the persistence unit used to create this EntityManagerFactory, or null if it is an unnamed default.

Method Detail

createNativeEntityManagerback to summary
public EntityManager createNativeEntityManager(Map<?, ?> properties)

Create a native JPA EntityManager to be used as the framework-managed resource behind an application-level EntityManager handle.

This exposes a native EntityManager from the underlying native EntityManagerFactory, taking JpaVendorAdapter#postProcessEntityManager(EntityManager) into account.

Since
5.3
See Also
getNativeEntityManagerFactory(), EntityManagerFactory#createEntityManager()
getBeanClassLoaderback to summary
public ClassLoader getBeanClassLoader()

Return the ClassLoader that the application's beans are loaded with.

Proxies will be generated in this ClassLoader.

getDataSourceback to summary
public DataSource getDataSource()

Return the JDBC DataSource that this EntityManagerFactory obtains its JDBC Connections from.

Returns:DataSource

the JDBC DataSource, or null if not known

Annotations
@Nullable
getEntityManagerInterfaceback to summary
public Class<? extends EntityManager> getEntityManagerInterface()

Return the (potentially vendor-specific) EntityManager interface that this factory's EntityManagers will implement.

A null return value suggests that autodetection is supposed to happen: either based on a target EntityManager instance or simply defaulting to jakarta.persistence.EntityManager.

Annotations
@Nullable
getJpaDialectback to summary
public JpaDialect getJpaDialect()

Return the vendor-specific JpaDialect implementation for this EntityManagerFactory, or null if not known.

Annotations
@Nullable
getNativeEntityManagerFactoryback to summary
public EntityManagerFactory getNativeEntityManagerFactory()

Return the raw underlying EntityManagerFactory.

Returns:EntityManagerFactory

the unadorned EntityManagerFactory (never null)

getPersistenceProviderback to summary
public PersistenceProvider getPersistenceProvider()

Return the underlying PersistenceProvider that the underlying EntityManagerFactory was created with.

Returns:PersistenceProvider

the PersistenceProvider used to create this EntityManagerFactory, or null if the standard JPA provider autodetection process was used to configure the EntityManagerFactory

Annotations
@Nullable
getPersistenceUnitInfoback to summary
public PersistenceUnitInfo getPersistenceUnitInfo()

Return the PersistenceUnitInfo used to create this EntityManagerFactory, if the in-container API was used.

Returns:PersistenceUnitInfo

the PersistenceUnitInfo used to create this EntityManagerFactory, or null if the in-container contract was not used to configure the EntityManagerFactory

Annotations
@Nullable
getPersistenceUnitNameback to summary
public String getPersistenceUnitName()

Return the name of the persistence unit used to create this EntityManagerFactory, or null if it is an unnamed default.

If getPersistenceUnitInfo() returns non-null, the result of getPersistenceUnitName() must be equal to the value returned by PersistenceUnitInfo.getPersistenceUnitName().

Annotations
@Nullable
See Also
getPersistenceUnitInfo(), jakarta.persistence.spi.PersistenceUnitInfo#getPersistenceUnitName()