Top Description Methods
org.springframework.orm.jpa

public Interface JpaVendorAdapter

Known Direct Implementers
org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter
Imports
java.util.Collections, .Map, jakarta.persistence.EntityManager, .EntityManagerFactory, jakarta.persistence.spi.PersistenceProvider, .PersistenceUnitInfo, org.springframework.lang.Nullable

SPI interface that allows to plug in vendor-specific behavior into Spring's EntityManagerFactory creators. Serves as single configuration point for all vendor-specific properties.
Authors
Juergen Hoeller, Rod Johnson
Since
2.0
See Also
AbstractEntityManagerFactoryBean#setJpaVendorAdapter

Method Summary

Modifier and TypeMethod and Description
public default Class<? extends EntityManagerFactory>
getEntityManagerFactoryInterface()

Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.

public default Class<? extends EntityManager>
getEntityManagerInterface()

Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement.

public default JpaDialect
getJpaDialect()

Return the vendor-specific JpaDialect implementation for this provider, or null if there is none.

public default Map<String, ?>

Returns:

a Map of JPA properties, as accepted by the standard JPA bootstrap facilities, or an empty Map if there are no properties to expose
getJpaPropertyMap
(PersistenceUnitInfo
the PersistenceUnitInfo for the current persistence unit
pui
)

Return a Map of vendor-specific JPA properties for the given persistence unit, typically based on settings in this JpaVendorAdapter instance.

public default Map<String, ?>

Returns:

a Map of JPA properties, as accepted by the standard JPA bootstrap facilities, or an empty Map if there are no properties to expose
getJpaPropertyMap
()

Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.

public PersistenceProvider
getPersistenceProvider()

Return the vendor-specific persistence provider.

public default String
getPersistenceProviderRootPackage()

Return the name of the persistence provider's root package (e.g. "oracle.toplink.essentials").

public default void
postProcessEntityManager(EntityManager em)

Optional callback for post-processing the native EntityManager before active use.

public default void
postProcessEntityManagerFactory(EntityManagerFactory emf)

Optional callback for post-processing the native EntityManagerFactory before active use.

Method Detail

getEntityManagerFactoryInterfaceback to summary
public default Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface()

Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.

If the provider does not offer any EntityManagerFactory extensions, the adapter should simply return the standard jakarta.persistence.EntityManagerFactory class here.

Since
2.5.2
getEntityManagerInterfaceback to summary
public default Class<? extends EntityManager> getEntityManagerInterface()

Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement.

If the provider does not offer any EntityManager extensions, the adapter should simply return the standard jakarta.persistence.EntityManager class here.

getJpaDialectback to summary
public default JpaDialect getJpaDialect()

Return the vendor-specific JpaDialect implementation for this provider, or null if there is none.

Annotations
@Nullable
getJpaPropertyMapback to summary
public default Map<String, ?> getJpaPropertyMap(PersistenceUnitInfo pui)

Return a Map of vendor-specific JPA properties for the given persistence unit, typically based on settings in this JpaVendorAdapter instance.

Note that there might be further JPA properties defined on the EntityManagerFactory bean, which might potentially override individual JPA property values specified here.

This implementation delegates to getJpaPropertyMap() for non-unit-dependent properties. Effectively, this PersistenceUnitInfo-based variant only needs to be implemented if there is an actual need to react to unit-specific characteristics such as the transaction type.

Note

This variant will only be invoked in case of Jakarta EE style container bootstrapping where a PersistenceUnitInfo is present (i.e. LocalContainerEntityManagerFactoryBean). In case of simple Java SE style bootstrapping via jakarta.persistence.Persistence (i.e. LocalEntityManagerFactoryBean), the parameter-less getJpaPropertyMap() variant will be called directly.

Parameters
pui:PersistenceUnitInfo

the PersistenceUnitInfo for the current persistence unit

Returns:Map<String, ?>

a Map of JPA properties, as accepted by the standard JPA bootstrap facilities, or an empty Map if there are no properties to expose

Since
4.3.13
See Also
PersistenceUnitInfo#getTransactionType(), jakarta.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
getJpaPropertyMapback to summary
public default Map<String, ?> getJpaPropertyMap()

Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.

Note that there might be further JPA properties defined on the EntityManagerFactory bean, which might potentially override individual JPA property values specified here.

Returns:Map<String, ?>

a Map of JPA properties, as accepted by the standard JPA bootstrap facilities, or an empty Map if there are no properties to expose

See Also
jakarta.persistence.Persistence#createEntityManagerFactory(String, Map)
getPersistenceProviderback to summary
public PersistenceProvider getPersistenceProvider()

Return the vendor-specific persistence provider.

getPersistenceProviderRootPackageback to summary
public default String getPersistenceProviderRootPackage()

Return the name of the persistence provider's root package (e.g. "oracle.toplink.essentials"). Will be used for excluding provider classes from temporary class overriding.

Annotations
@Nullable
Since
2.5.2
postProcessEntityManagerback to summary
public default void postProcessEntityManager(EntityManager em)

Optional callback for post-processing the native EntityManager before active use.

This can be used for setting vendor-specific parameters, e.g. Hibernate filters, on every new EntityManager.

Since
5.3
postProcessEntityManagerFactoryback to summary
public default void postProcessEntityManagerFactory(EntityManagerFactory emf)

Optional callback for post-processing the native EntityManagerFactory before active use.

This can be used for triggering vendor-specific initialization processes. While this is not expected to be used for most providers, it is included here as a general extension hook.