org.springframework.orm.jpa.JpaVendorAdapter implementation for Hibernate.
Compatible with Hibernate ORM 5.5/5.6 as well as 6.0/6.1/6.2/6.3.
Exposes Hibernate's persistence provider and Hibernate's Session as extended
EntityManager interface, and adapts AbstractJpaVendorAdapter's common
configuration settings. Also supports the detection of annotated packages (through
org.),
e.g. containing Hibernate org. annotations,
along with Spring-driven entity scanning which requires no persistence.xml
(org.).
A note about HibernateJpaVendorAdapter vs native Hibernate settings:
Some settings on this adapter may conflict with native Hibernate configuration rules
or custom Hibernate properties. For example, specify either setDatabase or
Hibernate's "hibernate.dialect_resolvers" property, not both. Also, be careful about
Hibernate's connection release mode: This adapter prefers ON_CLOSE behavior,
aligned with HibernateJpaDialect#setPrepareConnection, at least for non-JTA
scenarios; you may override this through corresponding native Hibernate properties.
HibernateJpaDialect
| Modifier and Type | Field and Description |
|---|---|
| private final Class | |
| private final Class | |
| private final HibernateJpaDialect | |
| private static final boolean | |
| private final PersistenceProvider |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private Map | |
| protected Class | Returns: the Hibernate database dialect class, ornull if none foundthe target database database)Determine the Hibernate database dialect class for the given target database. |
| public Class | getEntityManagerFactoryInterface()
Overrides org. Overrides default org. Return the vendor-specific EntityManagerFactory interface that the EntityManagerFactory proxy is supposed to implement. |
| public Class | getEntityManagerInterface()
Overrides org. Overrides default org. Return the vendor-specific EntityManager interface that this provider's EntityManagers will implement. |
| public HibernateJpaDialect | getJpaDialect()
Overrides org. Overrides default org. Return the vendor-specific JpaDialect implementation for this
provider, or |
| public Map | getJpaPropertyMap(PersistenceUnitInfo
the PersistenceUnitInfo for the current persistence unit pui)Overrides org. Overrides default org. Return a Map of vendor-specific JPA properties for the given persistence unit, typically based on settings in this JpaVendorAdapter instance. |
| public Map | getJpaPropertyMap()
Overrides org. Overrides default org. Return a Map of vendor-specific JPA properties, typically based on settings in this JpaVendorAdapter instance. |
| public PersistenceProvider | getPersistenceProvider()
Implements org. Return the vendor-specific persistence provider. |
| public String | getPersistenceProviderRootPackage()
Overrides org. Overrides default org. Return the name of the persistence provider's root package (e.g. "oracle.toplink.essentials"). |
| public void | setPrepareConnection(boolean prepareConnection)
Set whether to prepare the underlying JDBC Connection of a transactional Hibernate Session, that is, whether to apply a transaction-specific isolation level and/or the transaction's read-only flag to the underlying JDBC Connection. |
| entityManagerFactoryInterface | back to summary |
|---|---|
| private final Class<? extends EntityManagerFactory> entityManagerFactoryInterface | |
| entityManagerInterface | back to summary |
|---|---|
| private final Class<? extends EntityManager> entityManagerInterface | |
| jpaDialect | back to summary |
|---|---|
| private final HibernateJpaDialect jpaDialect | |
| oldDialectsPresent | back to summary |
|---|---|
| private static final boolean oldDialectsPresent | |
| persistenceProvider | back to summary |
|---|---|
| private final PersistenceProvider persistenceProvider | |
| HibernateJpaVendorAdapter | back to summary |
|---|---|
| public HibernateJpaVendorAdapter() | |
| buildJpaPropertyMap | back to summary |
|---|---|
| private Map | |
| determineDatabaseDialectClass | back to summary |
|---|---|
| protected Class Determine the Hibernate database dialect class for the given target database.
| |
| getEntityManagerFactoryInterface | back to summary |
|---|---|
| public Class Overrides org. Overrides default org. Doc from org. 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
| |
| getEntityManagerInterface | back to summary |
|---|---|
| public Class Overrides org. Overrides default org. Doc from org. 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
| |
| getJpaDialect | back to summary |
|---|---|
| public HibernateJpaDialect getJpaDialect() Overrides org. Overrides default org. Doc from org. Return the vendor-specific JpaDialect implementation for this
provider, or
| |
| getJpaPropertyMap | back to summary |
|---|---|
| public Map Overrides org. Overrides default org. Doc from org. 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 Note This variant will only be invoked in case of Jakarta EE style
container bootstrapping where a
| |
| getJpaPropertyMap | back to summary |
|---|---|
| public Map Overrides org. Overrides default org. Doc from org. 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. | |
| getPersistenceProvider | back to summary |
|---|---|
| public PersistenceProvider getPersistenceProvider() Implements org. Doc from org. Return the vendor-specific persistence provider.
| |
| getPersistenceProviderRootPackage | back to summary |
|---|---|
| public String getPersistenceProviderRootPackage() Overrides org. Overrides default org. Doc from org. 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.
| |
| setPrepareConnection | back to summary |
|---|---|
| public void setPrepareConnection(boolean prepareConnection) Set whether to prepare the underlying JDBC Connection of a transactional Hibernate Session, that is, whether to apply a transaction-specific isolation level and/or the transaction's read-only flag to the underlying JDBC Connection. See On Hibernate 5.1+, this flag remains NOTE: For a persistence unit with transaction type JTA e.g. on WebLogic,
the connection release mode will never be altered from its provider default,
i.e. not be forced to | |