类 AbstractJpaVendorAdapter
- java.lang.Object
- org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter
- 所有已实现的接口:
JpaVendorAdapter
public abstract class AbstractJpaVendorAdapter extends Object implements JpaVendorAdapter
AbstractJpaVendorAdapter
implementation that defines common properties, to be translated into vendor-specific JPA properties by concrete subclasses.- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller, Rod Johnson
构造器概要
构造器 构造器 说明 AbstractJpaVendorAdapter()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected Database
getDatabase()
Return the target database to operate on.protected String
getDatabasePlatform()
Return the name of the target database to operate on.Class<? extends EntityManagerFactory>
getEntityManagerFactoryInterface()
Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement.Class<? extends EntityManager>
getEntityManagerInterface()
Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement.JpaDialect
getJpaDialect()
Return the vendor-specific JpaDialect implementation for this provider, ornull
if there is none.Map<String,?>
getJpaPropertyMap()
Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance.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.String
getPersistenceProviderRootPackage()
Return the name of the persistence provider's root package (e.g.protected boolean
isGenerateDdl()
Return whether to generate DDL after the EntityManagerFactory has been initialized creating/updating all relevant tables.protected boolean
isShowSql()
Return whether to show SQL in the log (or in the console).void
postProcessEntityManagerFactory(EntityManagerFactory emf)
Optional callback for post-processing the native EntityManagerFactory before active use.void
setDatabase(Database database)
Specify the target database to operate on, as a value of theDatabase
enum: DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASEvoid
setDatabasePlatform(String databasePlatform)
Specify the name of the target database to operate on.void
setGenerateDdl(boolean generateDdl)
Set whether to generate DDL after the EntityManagerFactory has been initialized, creating/updating all relevant tables.void
setShowSql(boolean showSql)
Set whether to show SQL in the log (or in the console).从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.orm.jpa.JpaVendorAdapter
getPersistenceProvider
构造器详细资料
AbstractJpaVendorAdapter
public AbstractJpaVendorAdapter()
方法详细资料
setDatabase
public void setDatabase(Database database)
Specify the target database to operate on, as a value of theDatabase
enum: DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASENOTE: This setting will override your JPA provider's default algorithm. Custom vendor properties may still fine-tune the database dialect. However, there may nevertheless be conflicts: For example, specify either this setting or Hibernate's "hibernate.dialect_resolvers" property, not both.
getDatabase
protected Database getDatabase()
Return the target database to operate on.
setDatabasePlatform
public void setDatabasePlatform(String databasePlatform)
Specify the name of the target database to operate on. The supported values are vendor-dependent platform identifiers.
getDatabasePlatform
protected String getDatabasePlatform()
Return the name of the target database to operate on.
setGenerateDdl
public void setGenerateDdl(boolean generateDdl)
Set whether to generate DDL after the EntityManagerFactory has been initialized, creating/updating all relevant tables.Note that the exact semantics of this flag depend on the underlying persistence provider. For any more advanced needs, specify the appropriate vendor-specific settings as "jpaProperties".
NOTE: Do not set this flag to 'true' while also setting JPA 2.1's
javax.persistence.schema-generation.database.action
property. These two schema generation mechanisms - standard JPA versus provider-native - are mutually exclusive, e.g. with Hibernate 5.
isGenerateDdl
protected boolean isGenerateDdl()
Return whether to generate DDL after the EntityManagerFactory has been initialized creating/updating all relevant tables.
setShowSql
public void setShowSql(boolean showSql)
Set whether to show SQL in the log (or in the console).For more specific logging configuration, specify the appropriate vendor-specific settings as "jpaProperties".
isShowSql
protected boolean isShowSql()
Return whether to show SQL in the log (or in the console).
getPersistenceProviderRootPackage
public String getPersistenceProviderRootPackage()
从接口复制的说明:JpaVendorAdapter
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.
getJpaPropertyMap
public Map<String,?> getJpaPropertyMap(PersistenceUnitInfo pui)
从接口复制的说明:JpaVendorAdapter
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
JpaVendorAdapter.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-lessJpaVendorAdapter.getJpaPropertyMap()
variant will be called directly.- 指定者:
getJpaPropertyMap
在接口中JpaVendorAdapter
- 参数:
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
- 另请参阅:
PersistenceUnitInfo.getTransactionType()
,PersistenceProvider.createContainerEntityManagerFactory(PersistenceUnitInfo, Map)
getJpaPropertyMap
public Map<String,?> getJpaPropertyMap()
从接口复制的说明:JpaVendorAdapter
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.
- 指定者:
getJpaPropertyMap
在接口中JpaVendorAdapter
- 返回:
- 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
public JpaDialect getJpaDialect()
从接口复制的说明:JpaVendorAdapter
Return the vendor-specific JpaDialect implementation for this provider, ornull
if there is none.- 指定者:
getJpaDialect
在接口中JpaVendorAdapter
getEntityManagerFactoryInterface
public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface()
从接口复制的说明:JpaVendorAdapter
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.
getEntityManagerInterface
public Class<? extends EntityManager> getEntityManagerInterface()
从接口复制的说明:JpaVendorAdapter
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
public void postProcessEntityManagerFactory(EntityManagerFactory emf)
从接口复制的说明:JpaVendorAdapter
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.