Top Description Fields Constructors Methods
org.hibernate.jpa

public Class HibernatePersistenceProvider

extends Object
implements PersistenceProvider
Class Inheritance
All Implemented Interfaces
jakarta.persistence.spi.PersistenceProvider
Imports
java.util.Collections, .List, .Map, jakarta.persistence.EntityManagerFactory, .PersistenceException, jakarta.persistence.spi.LoadState, .PersistenceProvider, .PersistenceUnitInfo, .ProviderUtil, org.hibernate.boot.registry.classloading.spi.ClassLoaderService, org.hibernate.jpa.boot.internal.ParsedPersistenceXmlDescriptor, .PersistenceXmlParser, org.hibernate.jpa.boot.spi.Bootstrap, .EntityManagerFactoryBuilder, .PersistenceUnitDescriptor, .ProviderChecker, org.hibernate.jpa.internal.util.PersistenceUtilHelper, org.jboss.logging.Logger

The best-ever implementation of a JPA PersistenceProvider.
Authors
Gavin King, Steve Ebersole, Brett Meyer

Field Summary

Modifier and TypeField and Description
private final PersistenceUtilHelper.MetadataCache
private static final Logger
private final ProviderUtil

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public EntityManagerFactory
createContainerEntityManagerFactory(PersistenceUnitInfo
metadata for use by the persistence provider
info
,
Map<K, V>
a Map of integration-level properties for use by the persistence provider (may be null if no properties are specified). These properties may include properties to control schema generation. If a Bean Validation provider is present in the classpath, the container must pass the ValidatorFactory instance in the map with the key "jakarta.persistence.validation.factory". If the containing archive is a bean archive, the container must pass the BeanManager instance in the map with the key "jakarta.persistence.bean.manager".
properties
)

Implements jakarta.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory.

Called by the container when an EntityManagerFactory is to be created.
public EntityManagerFactory
createEntityManagerFactory(String
the name of the persistence unit
persistenceUnitName
,
Map<K, V>
a Map of properties for use by the persistence provider. These properties may be used to override the values of the corresponding elements in the persistence.xml file or specify values for properties not specified in the persistence.xml (and may be null if no properties are specified).
properties
)

Implements jakarta.persistence.spi.PersistenceProvider.createEntityManagerFactory.

Called by Persistence class when an EntityManagerFactory is to be created.
public void
generateSchema(PersistenceUnitInfo
metadata for use by the persistence provider
info
,
Map<K, V>
properties for schema generation; these may also include provider-specific properties
map
)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.
public boolean
generateSchema(String
the name of the persistence unit
persistenceUnitName
,
Map<K, V>
properties for schema generation; these may also contain provider-specific properties. The value of these properties override any values that may have been configured elsewhere.
map
)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.
protected EntityManagerFactoryBuilder
protected EntityManagerFactoryBuilder
getEntityManagerFactoryBuilder(PersistenceUnitDescriptor persistenceUnitDescriptor, Map<?, ?> integration, ClassLoader providedClassLoader)

protected EntityManagerFactoryBuilder
getEntityManagerFactoryBuilder(PersistenceUnitDescriptor persistenceUnitDescriptor, Map<?, ?> integration, ClassLoaderService providedClassLoaderService)

protected EntityManagerFactoryBuilder
getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties)

protected EntityManagerFactoryBuilder
getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties, ClassLoader providedClassLoader)

protected EntityManagerFactoryBuilder
getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties, ClassLoaderService providedClassLoaderService)

private EntityManagerFactoryBuilder
getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties, ClassLoader providedClassLoader, ClassLoaderService providedClassLoaderService)

public ProviderUtil
getProviderUtil()

Implements jakarta.persistence.spi.PersistenceProvider.getProviderUtil.

Return the utility interface implemented by the persistence provider.
protected static Map<?, ?>
wrap(Map<?, ?> properties)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private final PersistenceUtilHelper.MetadataCache cache
logback to summary
private static final Logger log
providerUtilback to summary
private final ProviderUtil providerUtil

Constructor Detail

HibernatePersistenceProviderback to summary
public HibernatePersistenceProvider()

Method Detail

createContainerEntityManagerFactoryback to summary
public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map<K, V> properties)

Implements jakarta.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory.

Doc from jakarta.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory.

Called by the container when an EntityManagerFactory is to be created.

Note

per-spec, the values passed as properties override values found in PersistenceUnitInfo

Parameters
info:PersistenceUnitInfo

metadata for use by the persistence provider

properties:Map<K, V>

a Map of integration-level properties for use by the persistence provider (may be null if no properties are specified). These properties may include properties to control schema generation. If a Bean Validation provider is present in the classpath, the container must pass the ValidatorFactory instance in the map with the key "jakarta.persistence.validation.factory". If the containing archive is a bean archive, the container must pass the BeanManager instance in the map with the key "jakarta.persistence.bean.manager".

Returns:EntityManagerFactory

EntityManagerFactory for the persistence unit specified by the metadata

Annotations
@Override
createEntityManagerFactoryback to summary
public EntityManagerFactory createEntityManagerFactory(String persistenceUnitName, Map<K, V> properties)

Implements jakarta.persistence.spi.PersistenceProvider.createEntityManagerFactory.

Doc from jakarta.persistence.spi.PersistenceProvider.createEntityManagerFactory.

Called by Persistence class when an EntityManagerFactory is to be created.

Implementation Specification

Per the specification, the values passed as properties override values found in persistence.xml

Parameters
persistenceUnitName:String

the name of the persistence unit

properties:Map<K, V>

a Map of properties for use by the persistence provider. These properties may be used to override the values of the corresponding elements in the persistence.xml file or specify values for properties not specified in the persistence.xml (and may be null if no properties are specified).

Returns:EntityManagerFactory

EntityManagerFactory for the persistence unit, or null if the provider is not the right provider

Annotations
@Override
generateSchemaback to summary
public void generateSchema(PersistenceUnitInfo info, Map<K, V> map)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Doc from jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.

Called by the container when schema generation is to occur as a separate phase from creation of the entity manager factory.

Parameters
info:PersistenceUnitInfo

metadata for use by the persistence provider

map:Map<K, V>

properties for schema generation; these may also include provider-specific properties

Annotations
@Override
generateSchemaback to summary
public boolean generateSchema(String persistenceUnitName, Map<K, V> map)

Implements jakarta.persistence.spi.PersistenceProvider.generateSchema.

Doc from jakarta.persistence.spi.PersistenceProvider.generateSchema.

Create database schemas and/or tables and/or create DDL scripts as determined by the supplied properties.

Called by the Persistence class when schema generation is to occur as a separate phase from creation of the entity manager factory.

Parameters
persistenceUnitName:String

the name of the persistence unit

map:Map<K, V>

properties for schema generation; these may also contain provider-specific properties. The value of these properties override any values that may have been configured elsewhere.

Returns:boolean

true if schema was generated, otherwise false

Annotations
@Override
getEntityManagerFactoryBuilderback to summary
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilder(PersistenceUnitInfo info, Map<?, ?> integration)
getEntityManagerFactoryBuilderback to summary
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilder(PersistenceUnitDescriptor persistenceUnitDescriptor, Map<?, ?> integration, ClassLoader providedClassLoader)
getEntityManagerFactoryBuilderback to summary
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilder(PersistenceUnitDescriptor persistenceUnitDescriptor, Map<?, ?> integration, ClassLoaderService providedClassLoaderService)
getEntityManagerFactoryBuilderOrNullback to summary
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties)
getEntityManagerFactoryBuilderOrNullback to summary
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties, ClassLoader providedClassLoader)
getEntityManagerFactoryBuilderOrNullback to summary
protected EntityManagerFactoryBuilder getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties, ClassLoaderService providedClassLoaderService)
getEntityManagerFactoryBuilderOrNullback to summary
private EntityManagerFactoryBuilder getEntityManagerFactoryBuilderOrNull(String persistenceUnitName, Map<?, ?> properties, ClassLoader providedClassLoader, ClassLoaderService providedClassLoaderService)
getProviderUtilback to summary
public ProviderUtil getProviderUtil()

Implements jakarta.persistence.spi.PersistenceProvider.getProviderUtil.

Doc from jakarta.persistence.spi.PersistenceProvider.getProviderUtil.

Return the utility interface implemented by the persistence provider.

Returns:ProviderUtil

ProviderUtil interface

Annotations
@Override
wrapback to summary
protected static Map<?, ?> wrap(Map<?, ?> properties)