接口 JpaVendorAdapter
public interface JpaVendorAdapter
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.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller, Rod Johnson
- 另请参阅:
AbstractEntityManagerFactoryBean.setJpaVendorAdapter(org.springframework.orm.jpa.JpaVendorAdapter)
方法概要
所有方法 实例方法 抽象方法 默认方法 修饰符和类型 方法 说明 default Class<? extends EntityManagerFactory>
getEntityManagerFactoryInterface()
Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.default Class<? extends EntityManager>
getEntityManagerInterface()
Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement.default JpaDialect
getJpaDialect()
Return the vendor-specific JpaDialect implementation for this provider, ornull
if there is none.default Map<String,?>
getJpaPropertyMap()
Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.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.PersistenceProvider
getPersistenceProvider()
Return the vendor-specific persistence provider.default String
getPersistenceProviderRootPackage()
Return the name of the persistence provider's root package (e.g.default void
postProcessEntityManagerFactory(EntityManagerFactory emf)
Optional callback for post-processing the native EntityManagerFactory before active use.
方法详细资料
getPersistenceProvider
PersistenceProvider getPersistenceProvider()
Return the vendor-specific persistence provider.
getPersistenceProviderRootPackage
@Nullable 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.- 从以下版本开始:
- 2.5.2
getJpaPropertyMap
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 Java EE style container bootstrapping where a
PersistenceUnitInfo
is present (i.e.LocalContainerEntityManagerFactoryBean
. In case of simple Java SE style bootstrapping viaPersistence
(i.e.LocalEntityManagerFactoryBean
), the parameter-lessgetJpaPropertyMap()
variant will be called directly.- 参数:
pui
- the PersistenceUnitInfo for the current persistence unit- 返回:
- a Map of JPA properties, as accepted by the standard JPA bootstrap facilities, or an empty Map if there are no properties to expose
- 从以下版本开始:
- 4.3.13
- 另请参阅:
PersistenceUnitInfo.getTransactionType()
,PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
getJpaPropertyMap
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.
- 返回:
- a Map of JPA properties, as accepted by the standard JPA bootstrap facilities, or an empty Map if there are no properties to expose
- 另请参阅:
Persistence.createEntityManagerFactory(String, Map)
getJpaDialect
@Nullable default JpaDialect getJpaDialect()
Return the vendor-specific JpaDialect implementation for this provider, ornull
if there is none.
getEntityManagerFactoryInterface
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
EntityManagerFactory
class here.- 从以下版本开始:
- 2.5.2
getEntityManagerInterface
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
EntityManager
class here.
postProcessEntityManagerFactory
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.