Top Description Fields Constructors Methods
org.springframework.orm.jpa.vendor

public abstract Class AbstractJpaVendorAdapter

extends Object
implements JpaVendorAdapter
Class Inheritance
All Implemented Interfaces
org.springframework.orm.jpa.JpaVendorAdapter
Known Direct Subclasses
org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter, org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
Imports
java.util.Collections, .Map, jakarta.persistence.EntityManager, .EntityManagerFactory, jakarta.persistence.spi.PersistenceUnitInfo, org.springframework.lang.Nullable, org.springframework.orm.jpa.JpaDialect, .JpaVendorAdapter

Abstract JpaVendorAdapter implementation that defines common properties, to be translated into vendor-specific JPA properties by concrete subclasses.
Authors
Juergen Hoeller, Rod Johnson
Since
2.0

Field Summary

Modifier and TypeField and Description
private Database
private String
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Database
getDatabase()

Return the target database to operate on.

protected String
getDatabasePlatform()

Return the name of the target database to operate on.

public Class<? extends EntityManagerFactory>
getEntityManagerFactoryInterface()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getEntityManagerFactoryInterface.

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

public Class<? extends EntityManager>
getEntityManagerInterface()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getEntityManagerInterface.

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

public JpaDialect
getJpaDialect()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getJpaDialect.

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

public Map<String, ?>
getJpaPropertyMap(PersistenceUnitInfo
the PersistenceUnitInfo for the current persistence unit
pui
)

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getJpaPropertyMap.

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

public Map<String, ?>
getJpaPropertyMap()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getJpaPropertyMap.

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

public String
getPersistenceProviderRootPackage()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getPersistenceProviderRootPackage.

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

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).

public void
postProcessEntityManager(EntityManager em)

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.postProcessEntityManager.

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

public void
postProcessEntityManagerFactory(EntityManagerFactory emf)

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.postProcessEntityManagerFactory.

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

public void
setDatabase(Database database)

Specify the target database to operate on, as a value of the Database enum: DB2, DERBY, H2, HANA, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE

Note

This setting will override your JPA provider's default algorithm.

public void
setDatabasePlatform(String databasePlatform)

Specify the name of the target database to operate on.

public void
setGenerateDdl(boolean generateDdl)

Set whether to generate DDL after the EntityManagerFactory has been initialized, creating/updating all relevant tables.

public void
setShowSql(boolean showSql)

Set whether to show SQL in the log (or in the console).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databaseback to summary
private Database database
databasePlatformback to summary
private String databasePlatform
Annotations
@Nullable
generateDdlback to summary
private boolean generateDdl
showSqlback to summary
private boolean showSql

Constructor Detail

AbstractJpaVendorAdapterback to summary
public AbstractJpaVendorAdapter()

Method Detail

getDatabaseback to summary
protected Database getDatabase()

Return the target database to operate on.

getDatabasePlatformback to summary
protected String getDatabasePlatform()

Return the name of the target database to operate on.

Annotations
@Nullable
getEntityManagerFactoryInterfaceback to summary
public Class<? extends EntityManagerFactory> getEntityManagerFactoryInterface()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getEntityManagerFactoryInterface.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.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.

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

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getEntityManagerInterface.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.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.

Annotations
@Override
getJpaDialectback to summary
public JpaDialect getJpaDialect()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getJpaDialect.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.getJpaDialect.

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

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

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getJpaPropertyMap.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.getJpaPropertyMap.

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

Annotations
@Override
getJpaPropertyMapback to summary
public Map<String, ?> getJpaPropertyMap()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getJpaPropertyMap.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.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

Annotations
@Override
getPersistenceProviderRootPackageback to summary
public String getPersistenceProviderRootPackage()

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.getPersistenceProviderRootPackage.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.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
@Override
@Nullable
isGenerateDdlback to summary
protected boolean isGenerateDdl()

Return whether to generate DDL after the EntityManagerFactory has been initialized creating/updating all relevant tables.

isShowSqlback to summary
protected boolean isShowSql()

Return whether to show SQL in the log (or in the console).

postProcessEntityManagerback to summary
public void postProcessEntityManager(EntityManager em)

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.postProcessEntityManager.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.postProcessEntityManager.

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.

Annotations
@Override
postProcessEntityManagerFactoryback to summary
public void postProcessEntityManagerFactory(EntityManagerFactory emf)

Overrides default org.springframework.orm.jpa.JpaVendorAdapter.postProcessEntityManagerFactory.

Doc from org.springframework.orm.jpa.JpaVendorAdapter.postProcessEntityManagerFactory.

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.

Annotations
@Override
setDatabaseback to summary
public void setDatabase(Database database)

Specify the target database to operate on, as a value of the Database enum: DB2, DERBY, H2, HANA, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE

Note

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.

setDatabasePlatformback to summary
public void setDatabasePlatform(String databasePlatform)

Specify the name of the target database to operate on. The supported values are vendor-dependent platform identifiers.

setGenerateDdlback to summary
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's jakarta.persistence.schema-generation.database.action property. These two schema generation mechanisms - standard JPA versus provider-native - are mutually exclusive, e.g. with Hibernate 5.

See Also
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean#setJpaProperties
setShowSqlback to summary
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".

See Also
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean#setJpaProperties